<?php

namespace App\Models;

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

class Banner extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = ["filename","content_id","content_type","caption","is_active"];

    public $appends = ['url'];

    public function getUrlAttribute(){
        return ($this->filename) ? Storage::disk("public")->url($this->filename): null;
    }
}
