ledgerrz/app/Models/Media.php
Daan Meijer 10bd46a53e
Some checks failed
linter / quality (push) Failing after 1m2s
tests / ci (8.3) (push) Failing after 48s
tests / ci (8.4) (push) Failing after 1m5s
tests / ci (8.5) (push) Failing after 1m5s
formatting, juiste use voor UpdateDynamicRequest
2026-06-22 00:10:39 +02:00

31 lines
558 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
class Media extends Model
{
use HasFactory;
protected $fillable = [
'file_path',
'file_name',
'mime_type',
];
protected $appends = ['url'];
public function mediable(): MorphTo
{
return $this->morphTo();
}
public function getUrlAttribute(): string
{
return asset('storage/'.$this->file_path);
}
}