generated from theradcoza/Laravel-Docker-Dev-Template
feat: add Shift Planning module with full CRUD, attendance, and reporting
- Add shifts, shift_staff, and shift_attendance migrations - Add Shift, ShiftStaff, ShiftAttendance Eloquent models with auditing - Add ShiftService with business logic (create, start, complete, assign staff, mark attendance, reports, timesheets) - Add ShiftResource with list, create, edit, and attendance management pages - Add staff and attendance relation managers - Add standalone pages: ActiveShifts, StaffManagement, ShiftReports, Timesheets - Add dashboard widgets: ShiftOverview stats, TodaysShifts table - Add ShiftPolicy for role-based authorization - Add 10 shift permissions and manager role to RolePermissionSeeder - Update User model with shift relationships - Fix audits table migration with required columns for owen-it/laravel-auditing - Update DatabaseSeeder to create admin user and call RolePermissionSeeder - Switch docker-compose to MariaDB 10.11 for Docker Desktop compatibility
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
@@ -47,4 +49,23 @@ protected function casts(): array
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
// --- Shift Relationships ---
|
||||
|
||||
public function shifts(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Shift::class, 'shift_staff')
|
||||
->withPivot('assigned_by')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function shiftAttendances(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShiftAttendance::class);
|
||||
}
|
||||
|
||||
public function createdShifts(): HasMany
|
||||
{
|
||||
return $this->hasMany(Shift::class, 'created_by');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user