51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use App\Policies\RolePolicy;
|
|
use App\Policies\PermissionPolicy;
|
|
use Spatie\Permission\Models\Role;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
// use Doctrine\DBAL\Types\Type;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// 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');
|
|
|
|
// if (!Type::hasType('citext')) {
|
|
// Type::addType('citext', \Doctrine\DBAL\Platforms\PostgreSqlPlatform::class);
|
|
// }
|
|
|
|
Gate::policy(Role::class, RolePolicy::class);
|
|
Gate::policy(Permission::class, PermissionPolicy::class);
|
|
|
|
ini_set('max_execution_time', 300); // 300 seconds = 5 minutes
|
|
ini_set('memory_limit', '512M'); // 512MB
|
|
}
|
|
}
|