createBranchProcess = new CreateBranchProcess(); } public function form(Form $form): Form { return $form ->schema([ Forms\Components\TextInput::make('code')->required()->unique('branches','code'), Forms\Components\TextInput::make('series')->label('Current Series') ->required() ->numeric() ->integer() ->maxLength(6) ->minLength(1) ->mask(RawJs::make(<<<'JS' '999999' JS)) ])->columns(1); } public function table(Table $table): Table { return $table ->recordTitleAttribute('client_id') ->columns([ Tables\Columns\TextColumn::make('code')->label('Branch Code'), Tables\Columns\TextColumn::make('current_series')->label('Current Series'), ]) ->filters([ // ]) ->headerActions([ Tables\Actions\CreateAction::make() ->mutateFormDataUsing(function (array $data): array { $data['client_id'] = $this->ownerRecord->id; return $data; }) ->using(function($data) { $payload = new CreateBranchDTO(data: $data); return $this->createBranchProcess->run($payload)->branch; }), ]) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } }