<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Appointment;

class Attachment extends Model
{
    use HasFactory;

    protected $fillable = ['appointment_id','filename','original_name','mime','size'];

    public function appointment()
    {
        return $this->belongsTo(Appointment::class);
    }

    public function getUrlAttribute()
    {
        return asset('storage/attachments/' . $this->filename);
    }
}
