silent-auction/app/Filament/Resources/VehiclesResource.php
2022-08-16 18:10:49 -04:00

96 lines
2.8 KiB
PHP

<?php
namespace App\Filament\Resources;
use App\Filament\Resources\VehiclesResource\Pages;
use App\Filament\Resources\VehiclesResource\RelationManagers;
use App\Models\Vehicles;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
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;
class VehiclesResource extends Resource
{
protected static ?string $model = Vehicles::class;
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Car Show';
public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('vehicleOwner.bidder_assigned_number')
->label('Number')
->sortable(),
TextColumn::make('year')
->label('Year')
->sortable(),
TextColumn::make('make')
->label('Make')
->sortable(),
TextColumn::make('model')
->label('Model')
->sortable(),
TextColumn::make('vehicleType.category_name')
->label('Type')
->sortable(),
BooleanColumn::make('doNotJudge')
->label('Judged?')
->sortable()
->falseIcon('heroicon-o-badge-check')
->trueIcon('heroicon-o-x-circle')
->trueColor('danger')
->falseColor('success'),
TextColumn::make('vehicleOwner.bidder_fname')
->label('First Name')
->sortable(),
TextColumn::make('vehicleOwner.bidder_lname')
->label('Last Name')
->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListVehicles::route('/'),
'create' => Pages\CreateVehicles::route('/create'),
'edit' => Pages\EditVehicles::route('/{record}/edit'),
];
}
}