<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;

class UploadFile extends Model
{

    //
    protected $guarded  = ["id"];

    public $appends = [
        "upload_file_link"
    ];

    protected function uploadFileLink(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => is_null($this->upload_link) ? null :Storage::url($this->upload_link),
        );
    }
}
