silent-auction/app/Filament/Resources/CarShowCategoryResource.php

73 lines
2.1 KiB
PHP

<?php
namespace App\Filament\Resources;
use App\Filament\Resources\CarShowCategoryResource\Pages;
use App\Filament\Resources\CarShowCategoryResource\RelationManagers;
use App\Filament\Resources\CarShowCategoryResource\RelationManagers\VehicleRelationManager;
use App\Models\CarShowCategory;
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 CarShowCategoryResource extends Resource
{
protected static ?string $model = CarShowCategory::class;
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Car Show';
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('category_name'),
Toggle::make('vehicle_type')->inline(false)
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('category_name')->sortable(),
BooleanColumn::make('vehicle_type')->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
])
->defaultSort('category_name');
}
public static function getRelations(): array
{
return [
RelationManagers\VehicleRelationManager::class,
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListCarShowCategories::route('/'),
'create' => Pages\CreateCarShowCategory::route('/create'),
'edit' => Pages\EditCarShowCategory::route('/{record}/edit'),
];
}
}