added media, mutation events, agent instructions
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user