<?php
 namespace App\Providers; use App\Models\Admin; use App\Models\Client; use App\Models\ClientCustomField; use App\Models\CommunicationTemplate; use App\Models\CustomReport; use App\Models\EmailCampaign; use App\Models\EmailMarketingList; use App\Models\EmailTemplate; use App\Models\Quote; use App\Models\EscalationRule; use App\Models\InvoiceBilling; use App\Models\Log; use App\Models\Product; use App\Models\ProductCategory; use App\Models\ProductConfigOption; use App\Models\ProductConfigOptionGroup; use App\Models\ProductGroup; use App\Models\SmsMessage; use App\Models\NotificationTemplate; use App\Models\SmsTemplate; use App\Models\TaxRule; use App\Models\TicketStatus; use App\Models\Tld; use App\Policies\AdminManagementPolicy; use App\Policies\ClientCustomFieldPolicy; use App\Policies\ClientPolicy; use App\Policies\CommunicationTemplatePolicy; use App\Policies\CustomReportPolicy; use App\Policies\EmailCampaignPolicy; use App\Policies\EmailMarketingListPolicy; use App\Policies\QuotePolicy; use App\Policies\EscalationRulePolicy; use App\Policies\InvoiceBillingPolicy; use App\Policies\LogPolicy; use App\Policies\PermissionManagementPolicy; use App\Policies\ProductCategoryPolicy; use App\Policies\ProductConfigOptionGroupPolicy; use App\Policies\ProductConfigOptionPolicy; use App\Policies\ProductGroupPolicy; use App\Policies\ProductPolicy; use App\Policies\RoleManagementPolicy; use App\Policies\SmsMessagePolicy; use App\Policies\TaxPolicy; use App\Policies\TicketStatusPolicy; use App\Policies\TldPolicy; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { protected $policies = [ Client::class => ClientPolicy::class, ClientCustomField::class => ClientCustomFieldPolicy::class, ProductGroup::class => ProductGroupPolicy::class, Product::class => ProductPolicy::class, ProductCategory::class => ProductCategoryPolicy::class, ProductConfigOption::class => ProductConfigOptionPolicy::class, ProductConfigOptionGroup::class => ProductConfigOptionGroupPolicy::class, ProductGroup::class => ProductGroupPolicy::class, Tld::class => TldPolicy::class, EscalationRule::class => EscalationRulePolicy::class, TicketStatus::class => TicketStatusPolicy::class, Admin::class => AdminManagementPolicy::class, CommunicationTemplate::class => CommunicationTemplatePolicy::class, EmailTemplate::class => CommunicationTemplatePolicy::class, SmsTemplate::class => CommunicationTemplatePolicy::class, NotificationTemplate::class => CommunicationTemplatePolicy::class, SmsMessage::class => SmsMessagePolicy::class, TaxRule::class => TaxPolicy::class, \Spatie\Permission\Models\Role::class => RoleManagementPolicy::class, \Spatie\Permission\Models\Permission::class => PermissionManagementPolicy::class, Log::class => LogPolicy::class, InvoiceBilling::class => InvoiceBillingPolicy::class, EmailMarketingList::class => EmailMarketingListPolicy::class, EmailCampaign::class => EmailCampaignPolicy::class, Quote::class => QuotePolicy::class, CustomReport::class => CustomReportPolicy::class, ]; public function boot(): void { \Illuminate\Session\Middleware\AuthenticateSession::redirectUsing( fn (\Illuminate\Http\Request $request) => \App\Http\Middleware\Authenticate::resolveLoginRedirect($request) ); Gate::define('view-client', function ($admin, $client) { return $admin->can('view', $client); }); Gate::define('edit-client', function ($admin, $client) { return $admin->can('update', $client); }); Gate::define('delete-client', function ($admin, $client) { return $admin->can('delete', $client); }); } } 