I keep getting
Unhandled Exception
Message:
Class 'User' not found
Location:
C:\wamp\www\laravel\laravel\auth\drivers\eloquent.php on line 70
When I'm logging in a user. I don't think there's any problem in eloquent.php. Please take a look at my login controller:
class Login_Controller extends Base_Controller {
public $restful = true;
public function get_index(){
return View::make('login');
}
public function post_index(){
$username = Input::get('username');
$password = Input::get('password');
$user_details = array('username' => $username, 'password' => $password);
if ( Auth::attempt($user_details) )
{
return Redirect::to('home.index');
}
else
{
return Redirect::to('login')
->with('login_errors', true);
}
}
}
This is the view of login:
{{ Form::open('login') }}
<!-- username field -->
<p>{{ Form::label('username', 'Username') }}</p>
<p>{{ Form::text('username') }}</p>
<!-- password field -->
<p>{{ Form::label('password', 'Password') }}</p>
<p>{{ Form::password('password') }}</p>
<!-- submit button -->
<p>{{ Form::submit('Login', array('class' => 'btn btn-primary')) }}</p>
{{ Form::close() }}
And routes.php:
<?php
Route::controller(Controller::detect()); // This line will map all our requests to all the controllers. If the controller or actions don’t exist, the system will return a 404 response.
Route::get('about', 'home@about');
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::to('login');
});
I used Eloquent as my authentication driver. I've tried changing it to Fluent, but after I click login button, it displays a login error made by this line return Redirect::to('login')->with('login_errors', true);
in the else statement.
What's wrong with 'User' class when using Eloquent?