feat: 문서 관리 시스템 MNG 관리자 패널 구현 (Phase 2)
- Document 관련 모델 4개 생성 (Document, DocumentApproval, DocumentData, DocumentAttachment) - DocumentController 생성 (목록/생성/상세/수정 페이지) - DocumentApiController 생성 (AJAX CRUD 처리) - 문서 관리 뷰 3개 생성 (index, edit, show) - 웹/API 라우트 등록 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
47
app/Models/Documents/DocumentData.php
Normal file
47
app/Models/Documents/DocumentData.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Documents;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class DocumentData extends Model
|
||||
{
|
||||
protected $table = 'document_data';
|
||||
|
||||
protected $fillable = [
|
||||
'document_id',
|
||||
'section_id',
|
||||
'column_id',
|
||||
'row_index',
|
||||
'field_key',
|
||||
'field_value',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'row_index' => 'integer',
|
||||
];
|
||||
|
||||
// =========================================================================
|
||||
// Relationships
|
||||
// =========================================================================
|
||||
|
||||
public function document(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Document::class);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Scopes
|
||||
// =========================================================================
|
||||
|
||||
public function scopeForSection($query, int $sectionId)
|
||||
{
|
||||
return $query->where('section_id', $sectionId);
|
||||
}
|
||||
|
||||
public function scopeForField($query, string $fieldKey)
|
||||
{
|
||||
return $query->where('field_key', $fieldKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user