vehicle sort

This commit is contained in:
2022-08-07 13:34:06 -04:00
parent 7d4964e268
commit 3c6097a5b2
5 changed files with 133 additions and 34 deletions

View File

@ -3,41 +3,51 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;
class Vehicles extends Model
class Vehicles extends Model implements Sortable
{
protected $table = 'vehicles';
protected $fillable = [
'year',
'make',
'model',
'type',
'doNotJudge',
'owner'
];
use SortableTrait;
public $sortable = [
'order_column_name' => 'owner',
'sort_when_creating' => true,
];
protected $dates = [
'created_at',
'updated_at'
];
protected $table = 'vehicles';
public function vehicleType()
{
return $this->belongsTo('App\Models\CarShowCategory', 'type', 'id');
}
protected $fillable = [
'year',
'make',
'model',
'type',
'doNotJudge',
'owner'
];
public function vehicleOwner()
{
return $this->belongsTo('App\Models\Bidders', 'owner', 'bidder_assigned_number');
}
protected $dates = [
'created_at',
'updated_at'
];
public function vehicleScores()
{
return $this->hasMany('App\Models\VechicleScores', 'id', 'vehicle');
}
public function vehicleType()
{
return $this->belongsTo('App\Models\CarShowCategory', 'type', 'id');
}
public function CarShowWinner()
{
return $this->belongsTo('App\Models\CarShowWinner', 'id', 'vehicle');
}
public function vehicleOwner()
{
return $this->belongsTo('App\Models\Bidders', 'owner', 'bidder_assigned_number');
}
public function vehicleScores()
{
return $this->hasMany('App\Models\VechicleScores', 'id', 'vehicle');
}
public function CarShowWinner()
{
return $this->belongsTo('App\Models\CarShowWinner', 'id', 'vehicle');
}
}