<?php

namespace App\Models;

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

class Pesan extends Model
{
    use HasFactory;

    protected $table = 'pesans';

    protected $fillable = [
        'pengirim_id',
        'pengirim_type',
        'penerima_id',
        'penerima_type',
        'isi_pesan',
        'sudah_dibaca'
    ];

    public function pengirim(): MorphTo
    {
        return $this->morphTo();
    }
    
    public function penerima(): MorphTo
    {
        return $this->morphTo();
    }
    
}