44 lines
773 B
PHP
44 lines
773 B
PHP
<?php
|
|
|
|
namespace App\Models\Commons;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class File extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'files';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'file_path',
|
|
'original_name',
|
|
'file_name',
|
|
'file_name_old',
|
|
'file_size',
|
|
'mime_type',
|
|
'description',
|
|
'fileable_id',
|
|
'fileable_type',
|
|
'uploaded_by',
|
|
];
|
|
|
|
/**
|
|
* 연관된 모델 (Polymorphic)
|
|
*/
|
|
public function fileable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
/**
|
|
* 업로더 (User 등)
|
|
*/
|
|
public function uploader()
|
|
{
|
|
return $this->belongsTo(User::class, 'uploaded_by');
|
|
}
|
|
}
|