<?php

namespace App\Models;

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

class Notification extends Model
{
    use HasFactory;
    protected $fillable = [
        'sender_id',
        'receiver_id',
        'title',
        'description',
        'type',
        'model_id',
        'is_read',
    ];

    public static function createRecord($receiverId, $title, $description, $senderId=null, $type=null, $modelId){
        return Notification::create([
            'sender_id' => $senderId,
            'receiver_id' => $receiverId,
            'title' => $title,
            'description' => $description,
            'type' => $type,
            'model_id' => $modelId, 
        ]);
    }
}
