Laravel Controllers: Controller Middleware
Controller Middleware
Class UserController extends Controller
{ /**
* Instantiate a new controller instance.
*
* @return void
*/ public function __construct()
{ $this->middleware('auth'); $this->middleware('log')->only('index'); $this->middleware('subscribed')->except('store'); } } - You may even restrict the middleware to only certain methods on the controller class.
- May be assigned to the controller's routes in your route files.
- You may assign middleware to a subset of controller actions.
Semantic portal