Added and updated policy
This commit is contained in:
@@ -2,9 +2,13 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use URL;
|
||||
use App\Policies\RolePolicy;
|
||||
use App\Policies\PermissionPolicy;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
// use Doctrine\DBAL\Types\Type;
|
||||
|
||||
@@ -23,8 +27,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Gate::before(function ($user, $ability) {
|
||||
return $user->hasRole('Super Admin') ? true : null;
|
||||
// Gate::before(function ($user, $ability) {
|
||||
// return $user->hasRole('Super Admin') ? true : null;
|
||||
// });
|
||||
|
||||
Gate::before(function (User $user, string $ability) {
|
||||
return $user->isSuperAdmin() ? true: null;
|
||||
});
|
||||
|
||||
// URL::forceScheme('https');
|
||||
@@ -32,5 +40,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
// if (!Type::hasType('citext')) {
|
||||
// Type::addType('citext', \Doctrine\DBAL\Platforms\PostgreSqlPlatform::class);
|
||||
// }
|
||||
|
||||
Gate::policy(Role::class, RolePolicy::class);
|
||||
Gate::policy(Permission::class, PermissionPolicy::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user