silent-auction/app/Models/CarShowCategory.php

40 lines
702 B
PHP
Raw Normal View History

2019-07-11 20:55:45 -04:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CarShowCategory extends Model
{
protected $table = 'car_show_categories';
2022-08-06 15:50:07 -04:00
protected static ?string $recordTitleAttribute = 'category_name';
2022-08-06 16:24:05 -04:00
protected $casts = [
'vehicle_type' => 'boolean',
];
2019-07-11 20:55:45 -04:00
protected $fillable = [
'category_name',
'vehicle_type'
];
protected $dates = [
'created_at',
'updated_at'
];
public function vehicle()
{
2022-08-08 14:55:05 -04:00
return $this->hasMany(Vehicles::class, 'type');
2019-07-11 20:55:45 -04:00
}
public function showWinner()
{
2022-08-08 14:57:49 -04:00
return $this->hasMany(CarShowWinner::class, 'category');
2019-07-11 20:55:45 -04:00
}
2022-08-28 15:08:15 -04:00
public function scopeVehtype($query)
{
return $query->where('vehicle_type', 1);
}
2019-07-11 20:55:45 -04:00
}