2022-08-06 15:39:24 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
|
|
|
|
use App\Filament\Resources\CarShowCategoryResource\Pages;
|
|
|
|
use App\Filament\Resources\CarShowCategoryResource\RelationManagers;
|
2022-08-06 19:02:34 -04:00
|
|
|
use App\Filament\Resources\CarShowCategoryResource\RelationManagers\VehicleRelationManager;
|
2022-08-06 15:39:24 -04:00
|
|
|
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;
|
2022-08-06 16:11:15 -04:00
|
|
|
use Filament\Tables\Columns\BooleanColumn;
|
|
|
|
use Filament\Tables\Columns\TextColumn;
|
2022-08-06 16:16:32 -04:00
|
|
|
use Filament\Forms\Components\TextInput;
|
2022-08-06 16:17:54 -04:00
|
|
|
use Filament\Forms\Components\Toggle;
|
2022-08-06 16:16:32 -04:00
|
|
|
|
2022-08-06 15:39:24 -04:00
|
|
|
class CarShowCategoryResource extends Resource
|
|
|
|
{
|
|
|
|
protected static ?string $model = CarShowCategory::class;
|
|
|
|
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-collection';
|
|
|
|
|
|
|
|
public static function form(Form $form): Form
|
|
|
|
{
|
|
|
|
return $form
|
|
|
|
->schema([
|
2022-08-06 16:16:32 -04:00
|
|
|
TextInput::make('category_name'),
|
2022-08-06 18:47:14 -04:00
|
|
|
Toggle::make('vehicle_type')->inline(false)
|
2022-08-06 15:39:24 -04:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function table(Table $table): Table
|
|
|
|
{
|
|
|
|
return $table
|
|
|
|
->columns([
|
2022-08-06 16:11:15 -04:00
|
|
|
TextColumn::make('category_name')->sortable(),
|
|
|
|
BooleanColumn::make('vehicle_type')->sortable(),
|
|
|
|
|
2022-08-06 15:39:24 -04:00
|
|
|
])
|
|
|
|
->filters([
|
|
|
|
//
|
|
|
|
])
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-08-06 15:46:22 -04:00
|
|
|
public static function getRelations(): array
|
|
|
|
{
|
|
|
|
return [
|
2022-08-06 19:13:29 -04:00
|
|
|
RelationManagers\VehicleRelationManager::class,
|
2022-08-06 15:46:22 -04:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2022-08-06 15:39:24 -04:00
|
|
|
public static function getPages(): array
|
|
|
|
{
|
|
|
|
return [
|
2022-08-06 15:46:22 -04:00
|
|
|
'index' => Pages\ListCarShowCategories::route('/'),
|
|
|
|
'create' => Pages\CreateCarShowCategory::route('/create'),
|
|
|
|
'edit' => Pages\EditCarShowCategory::route('/{record}/edit'),
|
2022-08-06 15:39:24 -04:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|