- GET /api/v1/calendar-schedules — 연도별 일정 목록 조회
- GET /api/v1/calendar-schedules/stats — 통계 조회
- GET /api/v1/calendar-schedules/{id} — 단건 조회
- POST /api/v1/calendar-schedules — 등록
- PUT /api/v1/calendar-schedules/{id} — 수정
- DELETE /api/v1/calendar-schedules/{id} — 삭제
- POST /api/v1/calendar-schedules/bulk — 대량 등록
42 lines
806 B
PHP
42 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Models\Commons;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Holiday extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'holidays';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'start_date',
|
|
'end_date',
|
|
'name',
|
|
'type',
|
|
'is_recurring',
|
|
'memo',
|
|
'created_by',
|
|
'updated_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'start_date' => 'date',
|
|
'end_date' => 'date',
|
|
'is_recurring' => 'boolean',
|
|
];
|
|
|
|
public function scopeForTenant($query, int $tenantId)
|
|
{
|
|
return $query->where('tenant_id', $tenantId);
|
|
}
|
|
|
|
public function scopeForYear($query, int $year)
|
|
{
|
|
return $query->whereYear('start_date', $year);
|
|
}
|
|
}
|