Compare commits

2 Commits

Author SHA1 Message Date
f63be7fa5e Merge pull request 'fix: enforce HTTPS in production environment' (#2) from fix/error-on-production into main
Reviewed-on: #2
2026-02-10 21:38:32 +00:00
Jp
7fa8b75b29 fix: enforce HTTPS in production environment
Add URL::forceScheme('https') in AppServiceProvider to ensure all generated URLs use HTTPS when the application is in production. This improves security by enforcing secure connections.
2026-02-11 05:37:54 +08:00

View File

@@ -4,6 +4,7 @@ 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;
@@ -22,6 +23,10 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
if ($this->app->environment('production')) {
URL::forceScheme('https');
}
Gate::before(function ($user, $ability) {
return $user->hasRole('super_admin') ? true : null;
});