- InstructorAvailabilityService checks: 1. Vacation (instructor_vacations table) 2. Regular availability (instructor_availability weekday/time windows) 3. Daily units limit (max_daily_units + max_daily_override) 4. Weekly units limit (max_weekly_units + max_weekly_override) 5. Break rules (between appointments, continuous minutes) - AppointmentsController now uses availabilityService - Fixed getQueryParam() -> getQueryParams() compatibility - Instructor model updated with max_*_units fields
37 lines
980 B
PHP
37 lines
980 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
final class Instructor extends Model
|
|
{
|
|
protected $table = 'instructors';
|
|
protected $fillable = [
|
|
'tenant_id', 'user_id', 'first_name', 'last_name',
|
|
'color', 'notes', 'is_active', 'pre_start_buffer_minutes',
|
|
'max_daily_units', 'max_daily_override',
|
|
'max_weekly_units', 'max_weekly_override',
|
|
];
|
|
protected $casts = [
|
|
'is_active' => 'integer',
|
|
'tenant_id' => 'integer',
|
|
'max_daily_units' => 'integer',
|
|
'max_daily_override' => 'integer',
|
|
'max_weekly_units' => 'integer',
|
|
'max_weekly_override' => 'integer',
|
|
];
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class, 'tenant_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
} |