vehicle scores setup

This commit is contained in:
Russ Long 2022-08-08 20:56:28 -04:00
parent 012a95bc36
commit 9bc97078fc

View File

@ -12,10 +12,11 @@ use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Columns\BooleanColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Select;
use App\Models\Vehicles;
use App\Models\Judges;
class VehicleScoresResource extends Resource
{
@ -29,7 +30,17 @@ class VehicleScoresResource extends Resource
{
return $form
->schema([
//
Select::make('judge')
->label('Judge')
->options(Judges::all()->pluck('judge_number', 'id'))
->searchable(),
Select::make('vehicle')
->label('Vehicle')
->options(Vehicles::all()->pluck('owner', 'id'))
->searchable(),
TextInput::make('overall_score')
->label('Overall Score'),
]);
}
@ -37,7 +48,9 @@ class VehicleScoresResource extends Resource
{
return $table
->columns([
//
TextColumn::make('judges.judge_number')->label('Judge'),
TextColumn::make('scoredVehicle.owner')->label('Vehicle Number'),
TextColumn::make('overall_score')->label('Score'),
])
->filters([
//
@ -53,7 +66,8 @@ class VehicleScoresResource extends Resource
public static function getRelations(): array
{
return [
//
RelationManagers\JudgeRelationManager::class,
RelationManagers\ScoredVehicleRelationManager::class,
];
}