F
Filament10mo ago
hxnnxs

Add button in custom register page

Hello everyone how can I add a button on a custom registration page? I tried using : use Filament\Forms\Components\Actions\Action; but I get the error: App\Filament\Pages\Auth\Register::getBackToDashboardComponent(): Return value must be of type Filament\Forms\Components\Component, Filament\Forms\Components\Actions\Action returned
Solution:
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('custom_button'),
])
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('custom_button'),
])
...
Jump to solution
3 Replies
Tieme
Tieme10mo ago
So, how does you page code look?
hxnnxs
hxnnxsOP10mo ago
<?php namespace App\Filament\Pages\Tenancy; use App\Models\Company; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Pages\Tenancy\RegisterTenant; use Illuminate\Database\Eloquent\Model; class RegisterCompany extends RegisterTenant { public static function getLabel(): string { return 'Create company'; } public function form(Form $form): Form { return $form ->schema([ TextInput::make('name') ->required() ->placeholder('FinTrack LTD.') ->minLength(2) ->maxLength(20) ->prefixIcon('heroicon-o-home') ->unique(), TextInput::make('short_name') ->required() ->prefixIcon('heroicon-o-home') ->placeholder('FT LTD.') ->minLength(2) ->maxLength(10) ->unique(), Select::make('type') ->required() ->options([ 'General' => 'General', 'Simplified' => 'Simplified', 'Patent' => 'Patent' ]) ]); } protected function handleRegistration(array $data): Company { $data['user_id'] = auth()->user()->id; $company = Company::create($data); $company->users()->attach(auth()->user()); return $company; } }
Solution
LeandroFerreira
LeandroFerreira10mo ago
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('custom_button'),
])
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('custom_button'),
])
Want results from more Discord servers?
Add your server