/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php
50 строк
1005 B
Ahmet Kaba
[10.x] Register policies automatically to the gate (#46132)
16 фев 2023, 22:35
Не верифицирован
16 фев 2023, 22:35
66ce77d
Код
Авторство
О чём код?
<?php namespace Illuminate\Foundation\Support\Providers; use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array<class-string, class-string> */ protected $policies = []; /** * Register the application's policies. * * @return void */ public function register() { $this->booting(function () { $this->registerPolicies(); }); } /** * Register the application's policies. * * @return void */ public function registerPolicies() { foreach ($this->policies() as $model => $policy) { Gate::policy($model, $policy); } } /** * Get the policies defined on the provider. * * @return array<class-string, class-string> */ public function policies() { return $this->policies; } }