feat: add legal opinions admin management

This commit is contained in:
2026-05-08 18:15:21 +03:30
parent 357859608f
commit ae522c5640
16 changed files with 649 additions and 1 deletions

View File

@@ -53,6 +53,11 @@ class Art extends Model
return $this->belongsToMany(JudicialPrecedent::class, 'art_judicial_precedent');
}
public function legalOpinions()
{
return $this->belongsToMany(LegalOpinion::class, 'art_legal_opinion');
}
public static function search($searchTerm)
{
return self::where('title', 'LIKE', "%{$searchTerm}%")

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LegalOpinion extends Model
{
use HasFactory;
protected $fillable = [
'opinion_number',
'opinion_date',
'subject',
'full_text',
'issuing_authority',
'category_id',
];
protected $hidden = ['created_at', 'updated_at'];
public function arts()
{
return $this->belongsToMany(Art::class, 'art_legal_opinion');
}
public function category()
{
return $this->belongsTo(LegalOpinionCategory::class, 'category_id');
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LegalOpinionCategory extends Model
{
use HasFactory;
protected $fillable = ['name'];
public function legalOpinions()
{
return $this->hasMany(LegalOpinion::class, 'category_id');
}
}