Middleware may be specified on controller routes like so:
Route::get('profile', [
'middleware' => 'auth',
'uses' => 'UserController@showProfile'
]);
Additionally, you may specify middleware within your controller's constructor:
class UserController extends Controller {
/**
* Instantiate a new UserController instance.
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('log', ['only' => ['fooAction', 'barAction']]);
$this->middleware('subscribed', ['except' => ['fooAction', 'barAction']]);
}
}