40 lines
828 B
PHP
40 lines
828 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\ArchiveSetting;
|
|
use App\Models\User;
|
|
|
|
class ArchiveSettingPolicy
|
|
{
|
|
protected function canManage(User $user): bool
|
|
{
|
|
return $user->hasPermission('manage-settings') || $user->hasRole(['admin']);
|
|
}
|
|
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return $this->canManage($user);
|
|
}
|
|
|
|
public function view(User $user, ArchiveSetting $setting): bool
|
|
{
|
|
return $this->canManage($user);
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
return $this->canManage($user);
|
|
}
|
|
|
|
public function update(User $user, ArchiveSetting $setting): bool
|
|
{
|
|
return $this->canManage($user);
|
|
}
|
|
|
|
public function delete(User $user, ArchiveSetting $setting): bool
|
|
{
|
|
return $this->canManage($user);
|
|
}
|
|
}
|