48 lines
892 B
PHP
48 lines
892 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class StoredFile extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'uuid',
|
|
'tenant_id',
|
|
'uploaded_by',
|
|
'disk',
|
|
'bucket',
|
|
'object_key',
|
|
'original_name',
|
|
'extension',
|
|
'mime_type',
|
|
'size',
|
|
'category',
|
|
'visibility',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['size' => 'integer'];
|
|
}
|
|
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'uuid';
|
|
}
|
|
|
|
public function uploader(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'uploaded_by');
|
|
}
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
}
|