components([ TextInput::make('account')->required(), Textarea::make('description')->nullable(), Select::make('account_type_id') ->relationship('accountType', 'type') ->required(), Select::make('normal_balance')->options( ['debit' => 'Debit', 'credit' => 'Credit'] )->required(), ]); } public function table(Table $table): Table { return $table ->recordTitleAttribute('client_id') ->columns([ TextColumn::make('account')->description(fn (Account $record): string => $record->description ?? ''), TextColumn::make('accountType.type'), TextColumn::make('accountType.normal_balance')->label('Normal Balance'), ]) ->filters([ // ]) ->headerActions([ Action::make('generate-base-accounts') ->requiresConfirmation() ->label('Generate Base Accounts') ->action(function () { $client = $this->getOwnerRecord(); if (! $client ) { return; } if($client->accounts()->count() > 0) { return; } app(GenerateBaseAccountCommand::class)->execute($client); }), ExportAction::make('Export Accounts')->exporter(ClientAccountsExporter::class)->formats([ExportFormat::Csv]), CreateAction::make()->label('New Account')->icon('heroicon-o-plus')->slideOver(), ]) ->recordActions([ EditAction::make()->slideOver(), DeleteAction::make()->requiresConfirmation(), ]) ->toolbarActions([ BulkActionGroup::make([ DeleteBulkAction::make()->icon('heroicon-s-trash')->requiresConfirmation(), ]), ]); } }