47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\License;
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use App\Policies\LicensePolicy;
|
|
use App\Policies\TenantPolicy;
|
|
use App\Policies\UserPolicy;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
if (app()->environment() !== 'testing') {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
Gate::policy(User::class, UserPolicy::class);
|
|
Gate::policy(License::class, LicensePolicy::class);
|
|
Gate::policy(Tenant::class, TenantPolicy::class);
|
|
|
|
Gate::define('attach-parent-child', function ($user, $parent, $child) {
|
|
return (new \App\Policies\ParentChildPolicy)->attach($user, $parent, $child);
|
|
});
|
|
|
|
Gate::define('detach-parent-child', function ($user, $parent, $child) {
|
|
return (new \App\Policies\ParentChildPolicy)->detach($user, $parent, $child);
|
|
});
|
|
}
|
|
}
|