Files
law-api/app/Models/BylawDocument.php

35 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BylawDocument extends Model
{
protected $table = 'bylaw_documents';
protected $fillable = ['title', 'category_id', 'approval_authority_id', 'approval_date', 'promulgation_authority_id', 'promulgation_date', 'promulgation_number', 'official_gazette_number', 'official_gazette_date', 'execution_date', 'bylaw_type', 'global_status', 'pdf_file_path', 'is_published', 'description'];
protected $casts = ['is_published' => 'boolean'];
public function category()
{
return $this->belongsTo(BylawSubjectCategory::class, 'category_id');
}
public function approvalAuthority()
{
return $this->belongsTo(BylawLegalAuthority::class, 'approval_authority_id');
}
public function promulgationAuthority()
{
return $this->belongsTo(BylawLegalAuthority::class, 'promulgation_authority_id');
}
public function nodes()
{
return $this->hasMany(BylawNode::class, 'document_id');
}
}