vehresource form

This commit is contained in:
Russ Long 2022-08-28 15:08:15 -04:00
parent f4a19837bb
commit d4a3fb430b
2 changed files with 26 additions and 2 deletions

View File

@ -15,7 +15,10 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Columns\BooleanColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Toggle;
use App\Models\Bidders;
use App\Models\CarShowCategory;
class VehiclesResource extends Resource
{
@ -29,7 +32,20 @@ class VehiclesResource extends Resource
{
return $form
->schema([
//
Select::make('owner')
->label('Owner')
->options(Bidders::all()->pluck('bidder_assigned_number', 'id'))
->searchable(),
TextInput::make('year')
->label('Year'),
TextInput::make('make')
->label('Make'),
TextInput::make('model')
->label('Model'),
Select::make('type')
->label('Type')
->options(CarShowCategory::vehtype()->pluck('category_name', 'id'))
->searchable(),
]);
}
@ -80,7 +96,10 @@ class VehiclesResource extends Resource
public static function getRelations(): array
{
return [
//
RelationManagers\CarShowWinnerRelationManager::class,
RelationManagers\VehicleOwnerRelationManager::class,
RelationManagers\VehicleScoresRelationManager::class,
RelationManagers\VehicleTypeRelationManager::class,
];
}

View File

@ -31,4 +31,9 @@ class CarShowCategory extends Model
{
return $this->hasMany(CarShowWinner::class, 'category');
}
public function scopeVehtype($query)
{
return $query->where('vehicle_type', 1);
}
}