Search code examples
laravellaravel-5.3laravelcollective

laravelcollective/html not finding any of my controllers


I am getting this error from a login page

Action App\Http\Controllers\Admin\LoginController@authenticate not defined. (View: /Applications/XAMPP/xamppfiles/htdocs/lectureme/resources/views/admin/login.blade.php)

I know for certain that this controller exists though, so why is it unable to find it? I have also created a new controller in the controller root and named it TestController, and tried routing to that instead, but that was also apparently not found.

Any suggestions for how to get access to the controller? Form code:

{!! Form::open(['action' => 'LoginController@authenticate']) !!}
    <div class="form-group">
        <div class="form-group">
            {!! Form::label('username', 'Username:') !!}
            {!! Form::text('username', null, ['class'=>'form-control']) !!}
        </div>
        <div class="form-group">
            {!! Form::label('email', 'Email Address:') !!}
            {!! Form::text('email', null, ['class'=>'form-control']) !!}
        </div>
    </div>
    <div class="form-group">
        {!! Form::submit('Login', ['class'=>'btn btn-primary']) !!}
    </div>
{!! Form::close() !!}

I have also tried composer dump-autoload and php artisan cache:clear


Solution

  • Make sure you namespaced your controller properly. Assuming you have placed your controller in the App\Http\Controllers\Admin directory it would be:

    namespace App\Http\Controllers\Admin