Back to School: coupon SCHOOL25 for 40% off Yearly/Lifetime membership! Read more here

Schedule for Doctors

Filament 4

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.

FilamentExamples ThumbBase (3)

Get the Source Code:

How it works

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.

Core Models and Relationships

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.

Schedule Management with Zap Package

The main schedule management happens in the custom Filament page ManageDoctorSchedule. This page demonstrates two key features of the Zap package:

  1. Creating Availability Rules - Regular working hours for doctors
  2. Creating Blocked Periods - Time when doctors are unavailable

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:

  • Schedule Displays
  • Working Hours
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 148 Premium Examples for $99