Last active
August 28, 2018 08:47
-
-
Save Denkong/04bd2de3efb2ca3429d73d690d406dab to your computer and use it in GitHub Desktop.
LARAVEL - посредники
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app/Http/Middleware/ | |
| php artisan make:middleware OldMiddleware - создание | |
| Пример | |
| if ($request->input('age') < 200) | |
| { | |
| return redirect('/'); | |
| } | |
| В Kernel.php | |
| app\http\kernel.php | |
| protected $routeMiddleware = [ | |
| 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, | |
| 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, | |
| 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, | |
| 'can' => \Illuminate\Auth\Middleware\Authorize::class, | |
| 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, | |
| 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, | |
| 'myAdmin' => Middleware\Access::class, | |
| 'myAdmin2' => Middleware\Access2::class, | |
| ]; | |
| В маршрутизаторе | |
| Route::get('/admin',['uses'=>'HomeController@MyAdmin','middleware'=>'myAdmin']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment