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:
44
src/app/Models/ShiftAttendance.php
Normal file
44
src/app/Models/ShiftAttendance.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use OwenIt\Auditing\Contracts\Auditable;
|
||||
|
||||
class ShiftAttendance extends Model implements Auditable
|
||||
{
|
||||
use \OwenIt\Auditing\Auditable;
|
||||
|
||||
protected $table = 'shift_attendance';
|
||||
|
||||
protected $fillable = [
|
||||
'shift_id',
|
||||
'user_id',
|
||||
'status',
|
||||
'marked_by',
|
||||
'marked_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'marked_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function shift(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Shift::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function marker(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'marked_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user