First Commit
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use App\Models\Subject;
|
||||
use App\Models\UserInterest;
|
||||
use App\Policies\SubjectPolicy;
|
||||
use App\Policies\UserInterestPolicy;
|
||||
|
||||
/**
|
||||
* Application authentication and authorization service provider.
|
||||
*/
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*/
|
||||
protected $policies = [
|
||||
Subject::class => SubjectPolicy::class,
|
||||
UserInterest::class => UserInterestPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
Gate::before(function ($user, $ability) {
|
||||
if ($user->hasRole('superadmin')) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user