- Migration: handling_status, handled_at, handled_by ke violations - Migration: tabel violation_handlings, handling_participants - Model: ViolationHandling, HandlingParticipant + relasi - Routes: storeHandling, resolveHandling, destroyHandling, calendar data - ViolationController: CRUD penanganan + filter status handling - DashboardController: data handling stats + calendar endpoint - Dashboard view: kalender pelanggaran interaktif (Alpine.js) - Violations index: filter status penanganan + kolom status - Violations show: stat card penanganan + timeline + modal tambah - Menambahkan handling_status filter di index
38 lines
843 B
PHP
38 lines
843 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ViolationHandling extends Model
|
|
{
|
|
protected $fillable = [
|
|
'violation_id', 'handling_type', 'handling_date',
|
|
'description', 'location', 'evidence', 'created_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'handling_date' => 'date',
|
|
];
|
|
}
|
|
|
|
public function violation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Violation::class);
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function participants(): HasMany
|
|
{
|
|
return $this->hasMany(HandlingParticipant::class, 'handling_id');
|
|
}
|
|
}
|