Files
MKM/app/Providers/AppServiceProvider.php
Jp ee65bdfb31 fix: force HTTPS scheme in all environments
Previously HTTPS was only enforced in production, which could lead to insecure URLs in other environments like staging. This change ensures consistent URL generation across all environments.
2026-02-11 05:41:22 +08:00

35 lines
704 B
PHP

<?php
namespace App\Providers;
use App\Policies\RolePolicy;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Spatie\Permission\Models\Role;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
URL::forceScheme('https');
Gate::before(function ($user, $ability) {
return $user->hasRole('super_admin') ? true : null;
});
Gate::policy(Role::class, RolePolicy::class);
}
}