Reputation: 37
I just tried Laravel 5 after a time at 4.2..
The docs says it is possible to use 'before' => 'auth'
as always, but for me it does not work.
I have no idea whats wrong, I have read the docs, search on internet but seems not to find anything. My code looks as:
$router->group(['before' => 'auth'], function($router)
{
//
$router->get('admin', function()
{
return View::make('admin.index');
});
//
$router->get('login', function()
{
return View::make('admin.login');
});
});
Anyone can see what I doing wrong here?
Upvotes: 2
Views: 4361
Reputation: 1368
In laravel5 filters are removed. Instead you can use middleware classes which are more clean.
In this blog you can read more about the middleware classes and that they're a replacement of filters.
If you want to do it with self written routes you can use this:
Route::group(['middleware' => 'auth'], function()
{
Route::get('admin', function()
{
return View::make('admin.index');
});
Route::->get('login', function()
{
return View::make('admin.login');
});
});
Upvotes: 7