<?php

namespace App\Models;

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

class Notification extends Model
{
    use HasFactory;

    protected $fillable = [
        'title', 
        'title_ar',
        'content',
        'content_ar',
        'user_id',
        'generated_by',
        'generated_to',
        'is_read',
        'image',
        'status',
        'main_notification_id',
    ];

    public function getImageAttribute($icon){

        return get_uploaded_image_url( $icon, 'notification_image_upload_dir', 'camera_placeholder.png' );
        
    }

    public function user(){
        return $this->belongsTo(User::class, 'id','user_id');
    }
}
