base commit

This commit is contained in:
Mekan1206 committed 2026-07-30 17:24:40 +05:00
commit a794dacd39
345 files changed
+29597

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Shift;
use App\Models\User;
use App\Policies\Concerns\ScopedByDepartment;
class ShiftPolicy
{
use ScopedByDepartment;
public function viewAny(User $user): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->canRead($user);
}
public function view(User $user, Shift $shift): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->canRead($user);
}
public function create(User $user): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->hasFullAccess($user);
}
public function update(User $user, Shift $shift): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->hasFullAccess($user);
}
public function delete(User $user, Shift $shift): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->hasFullAccess($user);
}
public function restore(User $user, Shift $shift): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->hasFullAccess($user);
}
public function forceDelete(User $user, Shift $shift): bool
{
if ($this->isSuperAdmin($user)) {
return true;
}
return $this->canForceDelete($user);
}
}