Answers for "Class 'App\Http\Controllers\Auth' not found"


Class "App\Http\Controllers\Auth" not found

use Illuminate\Support\Facades\Auth;
Posted by: Guest on June-09-2021

Class 'App\Http\Controllers\Admin\Route' not found

use Illuminate\Routing\Route;
Posted by: Guest on February-23-2021

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

public function store()
        $rules = array(
            'name'    => 'required',

        $validator = Validator::make(Input::all(), $rules);

        // if the validator fails, redirect back to the form
        if ($validator->fails()) {
            return Redirect::back()
                ->withErrors($validator) // send back all errors to the login form

            $input = input::all();

        } else {

            $company                = New Company();
            $company->name          = Input::get('name');
            $company->user_id       = Input::get('user_id');
            $company->country_id    = Input::get('country_id');
            $company->description   = Input::get('description');


            return Redirect::to('/backend')->withInput()->with('success', Company added.');

Posted by: Guest on October-20-2020

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

Because your controller is namespaced unless you specifically import the Auth namespace, PHP will assume it's under the namespace of the class, giving this error.

To fix this, add use Auth; at the top of AdminHomeController file along with your other use statements or alternatively prefix all instances of Auth with backslash like this: \Auth to let PHP know to load it from the global namespace.
Posted by: Guest on November-17-2020

Code answers related to "Class 'App\Http\Controllers\Auth' not found"

Browse Popular Code Answers by Language