2022-08-07 12:48:05 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Filament\Resources\VehiclesResource\RelationManagers;
|
|
|
|
|
|
|
|
use Filament\Forms;
|
|
|
|
use Filament\Resources\Form;
|
|
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
|
|
use Filament\Resources\Table;
|
|
|
|
use Filament\Tables;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
2023-03-16 13:37:56 -04:00
|
|
|
use App\Models\Vehicles;
|
|
|
|
use App\Models\Judges;
|
2022-08-07 12:48:05 -04:00
|
|
|
|
|
|
|
class VehicleScoresRelationManager extends RelationManager
|
|
|
|
{
|
|
|
|
protected static string $relationship = 'vehicleScores';
|
|
|
|
|
|
|
|
protected static ?string $recordTitleAttribute = 'id';
|
|
|
|
|
|
|
|
public static function form(Form $form): Form
|
|
|
|
{
|
|
|
|
return $form
|
|
|
|
->schema([
|
2023-03-16 13:37:56 -04:00
|
|
|
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'),
|
2022-08-07 12:48:05 -04:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function table(Table $table): Table
|
|
|
|
{
|
|
|
|
return $table
|
|
|
|
->columns([
|
2022-08-28 15:14:06 -04:00
|
|
|
Tables\Columns\TextColumn::make('judge'),
|
|
|
|
Tables\Columns\TextColumn::make('overall_score'),
|
2022-08-07 12:48:05 -04:00
|
|
|
])
|
|
|
|
->filters([
|
|
|
|
//
|
|
|
|
])
|
|
|
|
->headerActions([
|
|
|
|
Tables\Actions\CreateAction::make(),
|
|
|
|
])
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
Tables\Actions\DeleteAction::make(),
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|