Fix Pint formatting
This commit is contained in:
@@ -3,15 +3,14 @@
|
||||
namespace App\Services\Attendance;
|
||||
|
||||
use App\Models\Role;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
|
||||
class AttendancePolicyService
|
||||
{
|
||||
public function canEditDay(array $dayRow, array $currentUser): bool
|
||||
{
|
||||
$status = strtolower((string)($dayRow['status'] ?? 'draft'));
|
||||
$roles = array_map([$this, 'normalizeRole'], (array)($currentUser['roles'] ?? []));
|
||||
$permissions = array_map('strtolower', (array)($currentUser['permissions'] ?? []));
|
||||
$status = strtolower((string) ($dayRow['status'] ?? 'draft'));
|
||||
$roles = array_map([$this, 'normalizeRole'], (array) ($currentUser['roles'] ?? []));
|
||||
$permissions = array_map('strtolower', (array) ($currentUser['permissions'] ?? []));
|
||||
|
||||
$isAdmin = $this->isAdminLike($roles, $permissions);
|
||||
$isTeacher = in_array('teacher', $roles, true) || in_array('ta', $roles, true) || in_array('teacher_assistant', $roles, true);
|
||||
@@ -34,6 +33,7 @@ class AttendancePolicyService
|
||||
public function isTeacher(array $roles): bool
|
||||
{
|
||||
$roles = array_map([$this, 'normalizeRole'], $roles);
|
||||
|
||||
return in_array('teacher', $roles, true)
|
||||
|| in_array('ta', $roles, true)
|
||||
|| in_array('teacher_assistant', $roles, true)
|
||||
@@ -45,7 +45,7 @@ class AttendancePolicyService
|
||||
$roles = array_map([$this, 'normalizeRole'], $roles);
|
||||
$adminTokens = $this->adminRoleTokens();
|
||||
|
||||
if (!empty($adminTokens) && count(array_intersect($roles, $adminTokens)) > 0) {
|
||||
if (! empty($adminTokens) && count(array_intersect($roles, $adminTokens)) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class AttendancePolicyService
|
||||
|
||||
public function normalizeRole(?string $role): string
|
||||
{
|
||||
return str_replace([' ', '-'], '_', strtolower(trim((string)$role)));
|
||||
return str_replace([' ', '-'], '_', strtolower(trim((string) $role)));
|
||||
}
|
||||
|
||||
public function canManageEarlyDismissals(array $userRoles): bool
|
||||
@@ -123,6 +123,7 @@ class AttendancePolicyService
|
||||
}
|
||||
|
||||
$cache = array_keys($tokens);
|
||||
|
||||
return $cache;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user