Struggling with Route::resource() and 'auth' Middleware Is it just me who can't seem to assign the 'auth' middleware to a Route::resource()?
It doesn't seem to want to work when I assign the 'auth' middleware directly into __construct of the Controller either.
Can someone copy / paste working code for the above?
Here is a working example for Controller middleware:
use Illuminate\Routing\Controller;
class AwesomeController extends Controller {
public function __construct()
{
$this->middleware('csrf');
$this->middleware('auth', ['only' => 'update'])
}
}
You might checkout this blog post to read more:
http://mattstauffer.co/blog/laravel-5.0-middleware-filter-style
Same thing happening with me
@domioanna
Is it just me who can't seem to assign the 'auth' middleware to a Route::resource()?
$router->group(['middleware' => 'your.middleware'], function($router)
{
$router->resource('resource', 'resourceController');
});
Please sign in or create an account to participate in this conversation.