diff --git a/app/Filament/Resources/VehiclesResource.php b/app/Filament/Resources/VehiclesResource.php index 13cdec9..dfe613a 100644 --- a/app/Filament/Resources/VehiclesResource.php +++ b/app/Filament/Resources/VehiclesResource.php @@ -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, ]; } diff --git a/app/Models/CarShowCategory.php b/app/Models/CarShowCategory.php index 1fd5904..0a1311c 100644 --- a/app/Models/CarShowCategory.php +++ b/app/Models/CarShowCategory.php @@ -31,4 +31,9 @@ class CarShowCategory extends Model { return $this->hasMany(CarShowWinner::class, 'category'); } + + public function scopeVehtype($query) + { + return $query->where('vehicle_type', 1); + } }