Init(Core): Change repo
This commit is contained in:
43
app/Models/Gate.php
Normal file
43
app/Models/Gate.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Gate extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['title', 'number', 'part_id', 'chapter_id', 'section_id', 'book_id', 'volum_id', 'law_id','division_id'];
|
||||
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
public function branch()
|
||||
{
|
||||
return $this->hasMany(Branch::class);
|
||||
}
|
||||
|
||||
|
||||
public function art()
|
||||
{
|
||||
return $this->hasMany(Art::class);
|
||||
}
|
||||
|
||||
public function parts()
|
||||
{
|
||||
return $this->hasMany(Part::class);
|
||||
}
|
||||
|
||||
public static function search($searchTerm)
|
||||
{
|
||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->get();
|
||||
}
|
||||
|
||||
public static function searchLimit($searchTerm)
|
||||
{
|
||||
return self::where('title', 'LIKE', "%{$searchTerm}%")->limit(3)->get();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user