<?php
namespace App\Filament\Resources;
use App\Filament\Resources\GrondstoffenResource\Pages;
use App\Filament\Resources\GrondstoffenResource\RelationManagers;
use App\Models\Grondstoffen;
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 GrondstoffenResource extends Resource
{
protected static ?string $model = Grondstoffen::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $pluralModelLabel = 'Grondstoffen';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('klant_id')
->required()
->numeric(),
Forms\Components\TextInput::make('locatie')
->required()
->maxLength(255),
Forms\Components\TextInput::make('type')
->required()
->maxLength(255),
Forms\Components\TextInput::make('hoeveelheid')
->required()
->numeric(),
Forms\Components\Toggle::make('isSamengevoegd')
->required(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('klant_id')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('locatie')
->searchable(),
Tables\Columns\TextColumn::make('type')
->searchable(),
Tables\Columns\TextColumn::make('hoeveelheid')
->numeric()
->sortable(),
Tables\Columns\IconColumn::make('isSamengevoegd')
->boolean(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListGrondstoffen::route('/'),
'create' => Pages\CreateGrondstoffen::route('/create'),
'view' => Pages\ViewGrondstoffen::route('/{record}'),
'edit' => Pages\EditGrondstoffen::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\GrondstoffenResource\Pages;
use App\Filament\Resources\GrondstoffenResource\RelationManagers;
use App\Models\Grondstoffen;
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 GrondstoffenResource extends Resource
{
protected static ?string $model = Grondstoffen::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $pluralModelLabel = 'Grondstoffen';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('klant_id')
->required()
->numeric(),
Forms\Components\TextInput::make('locatie')
->required()
->maxLength(255),
Forms\Components\TextInput::make('type')
->required()
->maxLength(255),
Forms\Components\TextInput::make('hoeveelheid')
->required()
->numeric(),
Forms\Components\Toggle::make('isSamengevoegd')
->required(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('klant_id')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('locatie')
->searchable(),
Tables\Columns\TextColumn::make('type')
->searchable(),
Tables\Columns\TextColumn::make('hoeveelheid')
->numeric()
->sortable(),
Tables\Columns\IconColumn::make('isSamengevoegd')
->boolean(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListGrondstoffen::route('/'),
'create' => Pages\CreateGrondstoffen::route('/create'),
'view' => Pages\ViewGrondstoffen::route('/{record}'),
'edit' => Pages\EditGrondstoffen::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}