32 lines
525 B
PHP
32 lines
525 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Media extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'filename',
|
||
|
|
'path',
|
||
|
|
'mime_type',
|
||
|
|
'size',
|
||
|
|
'metadata',
|
||
|
|
'focal_x',
|
||
|
|
'focal_y',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'metadata' => 'array',
|
||
|
|
'focal_x' => 'float',
|
||
|
|
'focal_y' => 'float',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $appends = ['url'];
|
||
|
|
|
||
|
|
public function getUrlAttribute()
|
||
|
|
{
|
||
|
|
return asset('storage/' . $this->path);
|
||
|
|
}
|
||
|
|
}
|