Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 2 years ago.
0
Solution

I don't think you can pass the middleware to Route::get method.

Please check: http://laravel.com/docs/5.1/routing#route-group-middleware http://laravel.com/api/5.1/Illuminate/Routing/Router.html#method_get

Route::group(['middleware' => 'auth'], function () {

    Route::get('/', function ()    {
       
    });


});
0

Although I like the Route::group method better, you can use pass a middleware to get methods. If you want the first way to work, you would need to do something like this:

Route::get('/dashboard', ['middleware' => 'auth', 'uses' => 'DashboardController@index']);
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Axure axure Joined 15 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.