0

Searched for the entire internet and found nothing related.

I want to bind the paginate variable from input <input name="showLimit">

public function index()
{
    $showLimit = Input::get('showLimit');
    $drivers = Driver::paginate($showLimit);
    return view('manage.driver', compact('drivers'));
}

Error:

Class 'App\Http\Controllers\Input' not found

2 Answers 2

1

Use depency injection on the Request class.

use Illuminate\Http\Request;

public function index(Request $request) {
    $showLimit = $request->get('showLimit');
    $drivers = Driver::paginate($showLimit);
    return view('manage.driver', compact('drivers'));
}
Sign up to request clarification or add additional context in comments.

5 Comments

@FransiscoWijaya I've read your question and "I need it to update automatically" is not in there
@apokryfos but with binding, it will automatically sync one another right?
I think you're thinking of things like Vue or Angular which are client side. Laravel is server side so it only "binds" things on a per-request basis.
so what should i do? :'(
Use Vue. The basic boilerplate of laravel includes it. There's tutorials online.
0

it seem that you have wrong path for the Input class

$showLimit = Illuminate\Support\Facades\Input::get('showLimit');
$drivers = Driver::paginate($showLimit);
return view('manage.driver', compact('drivers'));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.