Init(Core): Change repo

This commit is contained in:
2026-04-24 15:29:37 +03:30
commit ededb41a3a
1499 changed files with 199187 additions and 0 deletions

67
app/Models/Art.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Art extends Model
{
use HasFactory;
protected $fillable = ['title', 'text', 'is_free', 'number', 'chapter_id', 'part_id', 'volum_id', 'law_id', 'book_id', 'section_id', 'gate_id', 'division_id', 'branch_id'];
protected $hidden = ['created_at', 'updated_at'];
public function chapter()
{
return $this->belongsTo(Chapter::class);
}
public function part()
{
return $this->belongsTo(Part::class);
}
public function volum()
{
return $this->belongsTo(Volum::class);
}
public function law()
{
return $this->belongsTo(Law::class);
}
public function book()
{
return $this->belongsTo(Book::class);
}
public function section()
{
return $this->belongsTo(Section::class);
}
public function gate()
{
return $this->belongsTo(Gate::class);
}
public function judicialPrecedents()
{
return $this->belongsToMany(JudicialPrecedent::class, 'art_judicial_precedent');
}
public static function search($searchTerm)
{
return self::where('title', 'LIKE', "%{$searchTerm}%")
->orWhere('text', 'like', "%{$searchTerm}%")->get();
}
public static function searchLimit($searchTerm)
{
return self::where('title', 'LIKE', "%{$searchTerm}%")
->orWhere('text', 'like', "%{$searchTerm}%")->limit(3)->get();
}
}