<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class RectorWelcome extends Model
{
    use HasFactory;

    protected $table = 'rector_welcomes';

    protected $fillable = [
        'campus_id',
        'greeting',
        'paragraphs', 
        'rector_name',
        'rector_photo_url',
    ];

    /**
     * Casting atribut ke tipe data asli.
     * Kolom 'paragraphs' akan diubah menjadi array saat diakses.
     */
    protected $casts = [
        'paragraphs' => 'array',
    ];

    public function campus()
    {
        return $this->belongsTo(Campus::class);
    }
}