This project demonstrates a doctor's schedule management system. It allows administrators to manage doctors across multiple clinics, set their availability rules, and block time periods for various reasons, such as holidays or conferences.
In this project, we make use of the laraveljutsu/zap package to manage doctor schedules across multiple clinics. The system allows administrators to set availability rules and block time periods for doctors.
The system uses three main models with many-to-many relationships:
app/Models/User.php (Doctor):
use Zap\Models\Concerns\HasSchedules; class User extends Authenticatable{ use HasFactory, Notifiable, HasSchedules; public function clinics(): BelongsToMany { return $this->belongsToMany(Clinic::class); } public function specialties(): BelongsToMany { return $this->belongsToMany(Specialty::class); } public function isDoctor(): bool { return $this->role === 'doctor'; }}
The HasSchedules
trait from the Zap package provides the relationship to schedules and schedule periods.
The main schedule management happens in the custom Filament page ManageDoctorSchedule
. This page demonstrates two key features of the Zap package:
app/Filament/Pages/ManageDoctorSchedule.php:
use Zap\Facades\Zap; public function createAvailabilityRule(array $data): void{ Zap::for($this->selectedDoctor) ->named('Availability Rule') ->availability() ->from($data['effective_from']) ->to($data['effective_to']) // ...
Next, we will build: