46 lines
1,010 B
PHP
46 lines
1,010 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\EleveurOcbStatus;
|
|
use App\Enums\GeoType;
|
|
use App\Enums\OCBType;
|
|
use App\Enums\PresentationType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Kwaadpepper\Enum\Traits\CastsEnums;
|
|
|
|
// old Breeders
|
|
class OCBBreeder extends Model
|
|
{
|
|
use CastsEnums;
|
|
|
|
protected $casts = [
|
|
'display' => 'boolean'
|
|
];
|
|
|
|
protected $enumCasts = [
|
|
'presentation_type' => PresentationType::class,
|
|
'ocbStatus' => EleveurOcbStatus::class,
|
|
'ocbType' => OCBType::class,
|
|
'geo_type' => GeoType::class
|
|
];
|
|
|
|
protected $table = 'ocb_breeders';
|
|
|
|
public function getRouteKeyName()
|
|
{
|
|
return "slug";
|
|
}
|
|
|
|
/**
|
|
* Get ocb validated breeders query
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Builder
|
|
*/
|
|
public static function ocbValidated()
|
|
{
|
|
return static::where('status', true)->whereHas('site', function ($q) {
|
|
$q->where('type', EleveurOcbStatus::yes()->value);
|
|
});
|
|
}
|
|
}
|