Monday, 8 November 2021

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

 In Laravel, the above error occurs because it cannot find the required class in the controller.

 

Sometimes, we use validation, and if validation fails, we need to show all old inputs.

inside form fields when we used to do the following.

For example

// Validation errors.

if ($validator->fails()) {

  return redirect()->back()->withInput(Input::all())->withErrors($validator)->withInput();

}

It will throw the error. 


if we do not include the required namespace.


Possible solution:

include namespace on the page something like the below screenshot. 

No comments:

Post a Comment

Laravel csrf token mismatch for ajax post request

Error "CSRF Token Mismatch" commonly occurs if tokens do not match in both sessions and sent , and received requests.CSRF token he...