39 lines
796 B
PHP
39 lines
796 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Documents;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 문서 레벨 연결 (실제 문서 작성 시 연결된 대상 기록)
|
||
|
|
*/
|
||
|
|
class DocumentLink extends Model
|
||
|
|
{
|
||
|
|
protected $table = 'document_links';
|
||
|
|
|
||
|
|
public $timestamps = false;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'document_id',
|
||
|
|
'link_id',
|
||
|
|
'linkable_id',
|
||
|
|
'sort_order',
|
||
|
|
'created_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'sort_order' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function document(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Document::class, 'document_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function linkDefinition(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(DocumentTemplateLink::class, 'link_id');
|
||
|
|
}
|
||
|
|
}
|