Ejemplo del archivo routes.php donde se controla si el usuario está logeado.
oRoute::post('registro', function(){
o
o$input = Input::all();
o$input['password'] = Hash::make($input['password']);
oUsuarios::create($input);
o
oreturn Redirect::to('login')->with('mensaje_registro', 'Usuario Registrado');
o});
oRoute::post('login', function(){
oif (Auth::attempt( array('correo' => Input::get('correo'), 'password' => Input::get('password') ), true )){
oreturn Redirect::to('inicio');
o}else{
oreturn Redirect::to('inicio')->with('mensaje_login', 'Ingreso invalido');
o}
o
o});
o
o if (Auth::check()){
oRoute::get('/', function(){
oreturn Redirect::to('factures');
o//echo 'Bienvenido '. Auth::user()->correo . ', su Id es: '.Auth::user()->id ;
o});
oRoute::get('clients', 'ClientController@mostrarClients');
oRoute::post('clients', 'ClientController@crearClient');
oRoute::get('factures', 'FacturaController@mostrarFactures');
oRoute::post('factures', 'FacturaController@crearFactura');
oRoute::get('factura/{id}', 'FacturaController@mostrarFactura');
oRoute::post('factura/{id}', 'ConceptoController@crearConcepto');
oRoute::any('{all}', function($uri){
oreturn Redirect::to('factures');
o})->where('all', '.*');
o}else{
oRoute::any('{all}', function($uri){
oreturn View::make('login');
o})->where('all', '.*');
o
o}
