50 خطوط
1.5 KiB
PHP
50 خطوط
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Call;
|
|
use App\Models\Campaign;
|
|
use App\Models\FollowUp;
|
|
use App\Models\ImportBatch;
|
|
use App\Models\Lead;
|
|
use App\Models\Setting;
|
|
use App\Models\User;
|
|
use App\Policies\CallPolicy;
|
|
use App\Policies\CampaignPolicy;
|
|
use App\Policies\FollowUpPolicy;
|
|
use App\Policies\ImportBatchPolicy;
|
|
use App\Policies\LeadPolicy;
|
|
use App\Policies\SettingPolicy;
|
|
use App\Policies\UserPolicy;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Gate::policy(Lead::class, LeadPolicy::class);
|
|
Gate::policy(Call::class, CallPolicy::class);
|
|
Gate::policy(FollowUp::class, FollowUpPolicy::class);
|
|
Gate::policy(Campaign::class, CampaignPolicy::class);
|
|
Gate::policy(User::class, UserPolicy::class);
|
|
Gate::policy(Setting::class, SettingPolicy::class);
|
|
Gate::policy(ImportBatch::class, ImportBatchPolicy::class);
|
|
|
|
Gate::define('view-report-data', fn(User $user) => $user->hasRole('admin') || $user->can('view_reports'));
|
|
Gate::define('export-report-data', fn(User $user) => $user->hasRole('admin') || $user->can('export_reports'));
|
|
Gate::define('export-sensitive-data', fn(User $user) => $user->hasRole('admin') || $user->can('export_leads') || $user->can('export_reports'));
|
|
}
|
|
}
|