| 12345678910111213141516171819202122232425262728 | 
							- <?php
 - 
 - namespace App\Policies;
 - 
 - use App\Models\User;
 - use App\Traits\SyncsWithCompanyDefaults;
 - use Illuminate\Database\Eloquent\Model;
 - 
 - class DefaultEnabledRecordPolicy
 - {
 -     /**
 -      * Create a new policy instance.
 -      */
 -     public function __construct()
 -     {
 -         //
 -     }
 - 
 -     /**
 -      * Determine whether the company can delete the existing record.
 -      */
 -     public function delete(User $user, Model $model): bool
 -     {
 -         $hasEnabledRecord = in_array(SyncsWithCompanyDefaults::class, class_uses_recursive($model), true);
 - 
 -         return ! ($hasEnabledRecord && $model->getAttribute('enabled') === true);
 -     }
 - }
 
 
  |