app/Providers/AuthServiceProvider.php: adding "administrate" gate.
This commit is contained in:
parent
d8917e118b
commit
c53a4155f4
1 changed files with 5 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
|
|
@ -25,5 +26,9 @@ class AuthServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
Gate::define('administrate', function(User $user) {
|
||||
return $user->role === 'admin';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue