Depends.
Copy and lap down the current routes.php
of a project under development.
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
*/
/*** "STATIC" SITE ***/
Route::group(array(), function()
{
Route::get('/', 'GuestController@index');
Route::get('/franqueado', 'GuestController@franqueado');
Route::controller('home', 'GuestController');
});
/*** AUTHENTICATION ***/
Route::group(array('before' => 'guest'), function()
{
Route::get( '/assinar', 'AuthController@signup' );
Route::post('/assinar', 'AuthController@signupHandler' );
Route::get( '/minha-conta', 'AuthController@login' );
Route::post('/minha-conta', 'AuthController@loginHandler' );
Route::get( '/franquia', 'AuthController@login' );
Route::post('/franquia', 'AuthController@loginHandler' );
});
Route::group(array(), function()
{
Route::any( '/minha-conta/logout', 'AuthController@logout' );
Route::any( '/confirmar/{code}', 'AuthController@verify' );
Route::get( '/solicitar-senha', 'AuthController@forgotPassword' );
Route::post( '/solicitar-senha', 'AuthController@forgotPasswordHandler');
Route::any( '/recuperar-senha/{code}', 'AuthController@resetPassword' )->where('code', '(.*)');
Route::any( '/franquia/logout', 'AuthController@logout' );
});
/*** "LOGGED-IN USER" SITE ***/
Route::controller('minha-conta', 'AssinanteController');
Route::controller('franquia', 'FranquiaController');
/*** SPECIAL ROUTES ***/
Route::group(array(), function()
{
// Use these routes while in local/development environment to see
// how these exceptional pages look like in the production environment
Route::get('/404', function()
{
return Response::view('special.missing', array(), 404);
});
Route::get('/500', function()
{
return Response::view('special.error', array('error' => 'Erro desconhecido'), 500);
});
Route::get('/down', function()
{
return Response::view('special.down', array(), 503);
});
});
As you can see, the bulk of the site is here, in these few simple lines:
/*** "LOGGED-IN USER" SITE ***/
Route::controller('minha-conta', 'AssinanteController');
Route::controller('franquia', 'FranquiaController');
I agree with the other answers: we need to maintain the organization, and we need to follow a coherent pattern - yours and/or the team.
I agree with that answer. Wrong is only a matter of perspective. I think that in the route file it is acceptable for you to redirect etc, if you go beyond this, if you start to involve the logic of the application, it is better to think about using a controller (to dispatch). This way, you will even be better prepared to in the future be able to "scale" the functionality in question.
– Kennedy Tedesco
I also do so by putting everything in controllers separate for each page/program.
– helderam