vehicle sort
This commit is contained in:
parent
7d4964e268
commit
3c6097a5b2
@ -33,8 +33,9 @@ class PeoplesChoiceResource extends Resource
|
|||||||
->schema([
|
->schema([
|
||||||
Select::make('vehicle')
|
Select::make('vehicle')
|
||||||
->label('Vehicle')
|
->label('Vehicle')
|
||||||
->options(Vehicles::all()->pluck('owner', 'id')->sortBy('owner'))
|
->options(Vehicles::all()->pluck('owner', 'id'))
|
||||||
->searchable(),
|
->searchable()
|
||||||
|
->orderable('owner'),
|
||||||
TextInput::make('pc_count'),
|
TextInput::make('pc_count'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -3,41 +3,51 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
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';
|
use SortableTrait;
|
||||||
protected $fillable = [
|
|
||||||
'year',
|
public $sortable = [
|
||||||
'make',
|
'order_column_name' => 'owner',
|
||||||
'model',
|
'sort_when_creating' => true,
|
||||||
'type',
|
];
|
||||||
'doNotJudge',
|
|
||||||
'owner'
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $dates = [
|
protected $table = 'vehicles';
|
||||||
'created_at',
|
|
||||||
'updated_at'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function vehicleType()
|
protected $fillable = [
|
||||||
{
|
'year',
|
||||||
return $this->belongsTo('App\Models\CarShowCategory', 'type', 'id');
|
'make',
|
||||||
}
|
'model',
|
||||||
|
'type',
|
||||||
|
'doNotJudge',
|
||||||
|
'owner'
|
||||||
|
];
|
||||||
|
|
||||||
public function vehicleOwner()
|
protected $dates = [
|
||||||
{
|
'created_at',
|
||||||
return $this->belongsTo('App\Models\Bidders', 'owner', 'bidder_assigned_number');
|
'updated_at'
|
||||||
}
|
];
|
||||||
|
|
||||||
public function vehicleScores()
|
public function vehicleType()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\VechicleScores', 'id', 'vehicle');
|
return $this->belongsTo('App\Models\CarShowCategory', 'type', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CarShowWinner()
|
public function vehicleOwner()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\CarShowWinner', 'id', 'vehicle');
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"filament/filament": "^2.0",
|
"filament/filament": "^2.0",
|
||||||
"laravel/framework": "^9.0",
|
"laravel/framework": "^9.0",
|
||||||
"laravel/tinker": "^2.0",
|
"laravel/tinker": "^2.0",
|
||||||
"laravel/ui": "^3.0"
|
"laravel/ui": "^3.0",
|
||||||
|
"spatie/eloquent-sortable": "^4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.7",
|
"barryvdh/laravel-debugbar": "^3.7",
|
||||||
|
75
composer.lock
generated
75
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c45f3039cd29758426fcc94f942f94f5",
|
"content-hash": "746d38f8fb6ae9be134c6ba49f0c1273",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "akaunting/laravel-money",
|
"name": "akaunting/laravel-money",
|
||||||
@ -3554,6 +3554,79 @@
|
|||||||
],
|
],
|
||||||
"time": "2021-02-11T11:37:01+00:00"
|
"time": "2021-02-11T11:37:01+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spatie/eloquent-sortable",
|
||||||
|
"version": "4.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/spatie/eloquent-sortable.git",
|
||||||
|
"reference": "64a3365c0d5a7b4a1837b2f29d01ee4c578c416a"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/spatie/eloquent-sortable/zipball/64a3365c0d5a7b4a1837b2f29d01ee4c578c416a",
|
||||||
|
"reference": "64a3365c0d5a7b4a1837b2f29d01ee4c578c416a",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/database": "^8.0|^9.0",
|
||||||
|
"illuminate/support": "^8.0|^9.0",
|
||||||
|
"php": "^8.0",
|
||||||
|
"spatie/laravel-package-tools": "^1.9"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^6.0|^7.0",
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Spatie\\EloquentSortable\\EloquentSortableServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Spatie\\EloquentSortable\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Freek Van der Herten",
|
||||||
|
"email": "freek@spatie.be"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Sortable behaviour for eloquent models",
|
||||||
|
"homepage": "https://github.com/spatie/eloquent-sortable",
|
||||||
|
"keywords": [
|
||||||
|
"behaviour",
|
||||||
|
"eloquent",
|
||||||
|
"laravel",
|
||||||
|
"model",
|
||||||
|
"sort",
|
||||||
|
"sortable"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/spatie/eloquent-sortable/issues",
|
||||||
|
"source": "https://github.com/spatie/eloquent-sortable/tree/4.0.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://spatie.be/open-source/support-us",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/spatie",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2022-01-21T08:32:41+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/laravel-package-tools",
|
"name": "spatie/laravel-package-tools",
|
||||||
"version": "1.12.1",
|
"version": "1.12.1",
|
||||||
|
14
config/eloquent-sortable.php
Normal file
14
config/eloquent-sortable.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
* Which column will be used as the order column.
|
||||||
|
*/
|
||||||
|
'order_column_name' => 'order_column',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define if the models should sort when creating.
|
||||||
|
* When true, the package will automatically assign the highest order number to a new mode
|
||||||
|
*/
|
||||||
|
'sort_when_creating' => true,
|
||||||
|
];
|
Loading…
Reference in New Issue
Block a user