91 lines
2.8 KiB
PHP
91 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\User\Resources;
|
|
|
|
use App\Filament\User\Resources\PackingResource\Pages;
|
|
use App\Filament\User\Resources\PackingResource\RelationManagers;
|
|
use App\Models\Packing;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
|
|
class PackingResource extends Resource
|
|
{
|
|
protected static ?string $model = Packing::class;
|
|
protected static ?string $navgationLabel = 'Verpackung & Größe';
|
|
protected static ?string $modelLabel = 'Verpackung & Größe';
|
|
protected static ?string $slug = 'verpackung';
|
|
protected static ?string $navigationIcon = 'heroicon-o-shopping-bag';
|
|
protected static ?string $navigationGroup = 'Ressourcen';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Forms\Components\TextInput::make('name')
|
|
->required()
|
|
->maxLength(255),
|
|
Forms\Components\TextInput::make('size')
|
|
->label('Größe')
|
|
->required()
|
|
->numeric(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('name')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('size')
|
|
->label('Größe')
|
|
->numeric()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListPackings::route('/'),
|
|
'create' => Pages\CreatePacking::route('/create'),
|
|
'edit' => Pages\EditPacking::route('/{record}/edit'),
|
|
];
|
|
}
|
|
public static function getPluralLabel(): string
|
|
{
|
|
return 'Verpackung & Größe'; // Setze hier deinen eigenen Pluralbegriff ein
|
|
}
|
|
}
|