33 lines
683 B
PHP

<?php
namespace App\Policies;
use App\Models\User;
class WagePolicy
{
public function viewAny(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function view(User $user, $wage): bool
{
if (in_array($user->role, ['admin', 'manager'])) {
return true;
}
// Therapists can only see their own wages
return $wage->user_id === $user->id;
}
public function create(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function approve(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
}