Having trouble displaying my dashboard after signing in. Here is my UsersController, users/dashboard, filters and route files receptively:
UsersController:
public function postLogin() {
if(Auth::check()){
return 'Tisk tisk already logged in';
}
if(Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), Input::get('remember-me')))
{
return Redirect::intended('/')
->with('message', 'You are now logged in!');
}
return Redirect::to('/users/login')
->with('message', 'Your username/password combination was incorrect')
->withInput();
}
filters:
Route::filter('auth', function()
{
if (!Auth::check());
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('users/login');
}
}
});
Route::filter('auth.basic', function()
{
return Auth::basic();
});
routes:
Route::get('/', array('before'=>'auth',function(){
return View::make('users.dashboard');
}));
Route::controller('users', 'UsersController');
dashboard:
@extends('layouts.main')
@section('content')
<h1>LASA Dashboard</h1>
<p>Welcome to your Dashboard. You are awesomesauce!</p>
@stop
Am I setting up my route wrong? Every-time I try signing in it leads me back to the sign in page. Any advice would be helpful!
Thanks in advance
I'm so dumb... I knew it was a routing error. I changed the 'before' to 'after' in my routes file.
Route::get('/', array('after'=>'auth',function(){
return View::make('users.dashboard');
}));
Route::controller('users', 'UsersController');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community