1

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

A. Appleby
  • 469
  • 1
  • 10
  • 23
  • 1
    Have you namespaced your controller properly - assuming you have placed your controller in a `Controllers\Admin` directory it would be: `namespace App\Http\Controllers\Admin`, I would then guess (because I just direct to the route and not the controller action) that you may need to add that to your action: `['action' => 'Admin\LoginController@authenticate']` – craig_h Nov 05 '16 at 19:25
  • 1
    Namespace was wrong and I accidentally commented out my post route. Put as answer and I'll mark as accepted and correct – A. Appleby Nov 05 '16 at 19:31
  • No problem. It's actually something I do from time to time and can be really difficult to spot! – craig_h Nov 05 '16 at 19:53

1 Answers1

1

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

craig_h
  • 31,871
  • 6
  • 59
  • 68