29 lines
592 B
PHP
29 lines
592 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Modules\Core\File\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* A row per physical file Modules\Core\File\Services\FileService has
|
||
|
|
* stored — see that migration's own docblock for why `owner_type`/
|
||
|
|
* `owner_id` are nullable and what `purpose` is for.
|
||
|
|
*/
|
||
|
|
class File extends Model
|
||
|
|
{
|
||
|
|
protected $guarded = [];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'size' => 'integer',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function owner(): MorphTo
|
||
|
|
{
|
||
|
|
return $this->morphTo();
|
||
|
|
}
|
||
|
|
}
|