Files
silent-auction/app/Filament/Resources/VehiclesResource/RelationManagers/VehicleScoresRelationManager.php
T
2026-04-20 13:48:05 -04:00

62 lines
1.9 KiB
PHP

<?php
namespace App\Filament\Resources\VehiclesResource\RelationManagers;
use Filament\Forms;
use Filament\Schemas\Schema;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use App\Models\Vehicles;
use App\Models\Judges;
class VehicleScoresRelationManager extends RelationManager
{
protected static string $relationship = 'vehicleScores';
protected static ?string $recordTitleAttribute = 'id';
public function form(Schema $schema): Schema
{
return $schema
->components([
Forms\Components\Select::make('judge')
->label('Judge')
->options(Judges::all()->pluck('judge_number', 'id'))
->searchable(),
Forms\Components\Select::make('vehicle')
->label('Vehicle')
->options(Vehicles::all()->pluck('owner', 'id'))
->searchable(),
Forms\Components\TextInput::make('overall_score')
->label('Overall Score'),
]);
}
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('judge'),
Tables\Columns\TextColumn::make('overall_score'),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}