menomad.blogg.se

Laravel php 5.2
Laravel php 5.2










We've defined that the admin is a group that uses web (another group) and auth (a named route middleware). Let's make an admin group: protected $middlewareGroups = [ \App\Http\Middleware\Verif圜srfToken::class,Īs you can see, the keys can reference either a class or a route-specific middleware shortcut like throttle or auth. \Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \App\Http\Middleware\EncryptCookies::class, Out of the box, it comes with web and api: protected $middlewareGroups = [ There's a new property named $middlewareGroups that's an array each key is a name and each value is the corresponding middleware. You can define middleware groups in app\Http\Kernel.php. So remember my admin example above? We can now create an "admin" middleware group. Note: Even if you don't want to use the middleware "shortcuts" aspect of middleware groups, you should read on, because this is a big change to Laravel's global middleware stack. Laravel 5.2 has introduced something called middleware groups, which are essentially a shortcut to applying a larger group of middleware, using a single key. Maybe the API group gets a different auth middleware, and it might get an API-specific rate limiter or something else. Usually each of these groups get their own set of middleware-admin, for example, gets auth.

laravel php 5.2 laravel php 5.2

One of the first things I do in a new site is group my routes by logically distinct sections like "admin", "auth", "public". When you are creating a site of any significant size in Laravel, your routes file will often get pretty large.












Laravel php 5.2