Initial commit - Physiotherapy Clinic Management System

This commit is contained in:
Deploy committed 2026-03-10 00:38:51 +03:00
commit dbb326f2cc
300 files changed
+144285

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Appointment;
class AppointmentPolicy
{
public function viewAny(User $user): bool
{
return true;
}
public function view(User $user, Appointment $appointment): bool
{
if (in_array($user->role, ['admin', 'manager', 'receptionist'])) {
return true;
}
// Therapists can see their own appointments
return $appointment->user_id === $user->id;
}
public function create(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function update(User $user, Appointment $appointment): bool
{
if (in_array($user->role, ['admin', 'manager', 'receptionist'])) {
return true;
}
// Therapists can update their own appointments
return $appointment->user_id === $user->id;
}
public function delete(User $user, Appointment $appointment): bool
{
return in_array($user->role, ['admin', 'manager']);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Policies;
use App\Models\User;
class InvoicePolicy
{
public function viewAny(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function view(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function create(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function update(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function delete(User $user): bool
{
return $user->role === 'admin';
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Policies;
use App\Models\User;
class LedgerPolicy
{
public function viewAny(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function view(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function create(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
public function viewReports(User $user): bool
{
return in_array($user->role, ['admin', 'manager']);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Patient;
class PatientPolicy
{
public function viewAny(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist', 'therapist']);
}
public function view(User $user, Patient $patient): bool
{
if (in_array($user->role, ['admin', 'manager', 'receptionist'])) {
return true;
}
// Therapists can only see their own patients
if ($user->role === 'therapist') {
return $patient->appointments()->where('user_id', $user->id)->exists();
}
return false;
}
public function create(User $user): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function update(User $user, Patient $patient): bool
{
return in_array($user->role, ['admin', 'manager', 'receptionist']);
}
public function delete(User $user, Patient $patient): bool
{
return in_array($user->role, ['admin', 'manager']);
}
}
+32
View File
@@ -0,0 +1,32 @@
<?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']);
}
}