- Tabel school_informations (judul, isi, kategori, tanggal kegiatan, publish) - Menu admin 'Informasi Sekolah' (CRUD + permission manage-school-info) - API wali: GET /parent/school-informations (hanya yang dipublikasikan) - 2 data contoh: Jadwal UTS & Class Meet - Test suite tetap hijau (39 test)
29 lines
596 B
PHP
29 lines
596 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SchoolInformation extends Model
|
|
{
|
|
protected $table = 'school_informations';
|
|
|
|
protected $fillable = [
|
|
'title', 'content', 'category', 'event_date', 'is_published', 'published_at', 'created_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'event_date' => 'date',
|
|
'is_published' => 'boolean',
|
|
'published_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|