alan
alan
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
Okay, it’s just important to me that I follow best practices, and if there’s no better way to do it, then so be it.
18 replies
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
But what I’m still wondering about: The custom font from AppPanelProvider is applied using:
->font('Roboto', url: asset('css/fonts.css'), provider: LocalFontProvider::class)
->font('Roboto', url: asset('css/fonts.css'), provider: LocalFontProvider::class)

But the colors are not. That’s pretty strange, isn’t it?
18 replies
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
Thank you very much
18 replies
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
It worked!! Thanks a lot
18 replies
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
I will give it a try. Just out of curiosity: why do I have to do this at all and is it not taken over by the AppPanelProvider? And where is it in the documentation?
18 replies
FFilament
Created by alan on 2/15/2025 in #❓┊help
Custom Form Page in Filament with BasePage: Inheriting Theme Colors
No I didn't. How can I achieve this?
<?php
...

class AppServiceProvider extends ServiceProvider
{

public function register(): void {}

public function boot(): void { Model::unguard(); }
}
<?php
...

class AppServiceProvider extends ServiceProvider
{

public function register(): void {}

public function boot(): void { Model::unguard(); }
}
18 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
Ok nice thank you it worked
->afterValidation(function ($record, $get) {
$record->members_amount = $get('members_amount');
$record->members_other_benefits = $get('members_other_benefits');
...
$record->save();
}),
->afterValidation(function ($record, $get) {
$record->members_amount = $get('members_amount');
$record->members_other_benefits = $get('members_other_benefits');
...
$record->save();
}),
However, since I have multiple steps in the wizard, this approach results in repetitive code and creates unnecessary overhead. Is there a more maintainable method that can be used across all steps in Filament? And just to be sure: afterValidation only executes after successful validations, right?
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
Thanks @Matthew but unfortunately I don't know how to approach this. In my earlier messages I think I wrote something similar to an action handler but my question is: how can I distinct between edit and creating? this is my current state of code Models/Form.php
<?php

namespace App\Models;

...

class Form extends Model
{
use HasFactory;

protected $casts = [
...
];

public static function getForm(): array
{
return [
Wizard::make([
Wizard\Step::make('Step 1'),
...
Wizard\Step::make('Step 2'),
Wizard\Step::make('Step 3'),
Wizard\Step::make('Step 4')
])
->nextAction(fn (Action $action) => $action->alpineClickHandler('$wire.save()'))
];
}
}
<?php

namespace App\Models;

...

class Form extends Model
{
use HasFactory;

protected $casts = [
...
];

public static function getForm(): array
{
return [
Wizard::make([
Wizard\Step::make('Step 1'),
...
Wizard\Step::make('Step 2'),
Wizard\Step::make('Step 3'),
Wizard\Step::make('Step 4')
])
->nextAction(fn (Action $action) => $action->alpineClickHandler('$wire.save()'))
];
}
}
Filament/Resources/FormResource.php
<?php

namespace App\Filament\Resources;

...

class FormResource extends Resource
{
protected static ?string $model = Form::class;

public static function form(Form $form): Form
{
return $form
->schema(Form::getForm());
}

...
<?php

namespace App\Filament\Resources;

...

class FormResource extends Resource
{
protected static ?string $model = Form::class;

public static function form(Form $form): Form
{
return $form
->schema(Form::getForm());
}

...
Filament/Resources/FormResource/Pages/CreateForm.php
<?php

namespace App\Filament\Resources\FormResource\Pages;

...

class CreateForm extends CreateRecord
{
protected static string $resource = FormResource::class;
}
<?php

namespace App\Filament\Resources\FormResource\Pages;

...

class CreateForm extends CreateRecord
{
protected static string $resource = FormResource::class;
}
Filament/Resources/FormResource/Pages/EditForm.php
<?php

namespace App\Filament\Resources\FormResource\Pages;

...

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

...
}
<?php

namespace App\Filament\Resources\FormResource\Pages;

...

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

...
}
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
No description
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
@toeknee thanks for your help I want to save it only, when I'm editing a record. That's why it won't work. Also I have 10 steps so calling this function after each step seems a bit too much
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
has somebody an idea? The problem is still that I want to execute
$wire.save()
$wire.save()
on clicking the next button in a wizard but only if I'm currently editing the record
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
->nextAction(fn (Action $action) => $action->alpineClickHandler('$wire.save()'))
->nextAction(fn (Action $action) => $action->alpineClickHandler('$wire.save()'))
I found a way to save the form when clicking "Next." But the problem is that I only want to save the form when it’s already created and I'm editing it. Otherwise, I get errors when the entry isn't created yet, as I can't save something that isn’t created. So, how can I limit it so the $wire.save() function gets called only when editing? Additionally I would like to disable the creation notification.
13 replies
FFilament
Created by alan on 1/22/2025 in #❓┊help
Save Wizard on clicking next button with alpineClickHandler
I found a solution to log to the console when clicking "Next." Now, I need to figure out how to trigger client-side saving using AlpineJS. Any tips are appreciated.
Wizard::make([
Wizard\Step::make(__('Step 1'))
->schema([
...
]),
Wizard\Step::make(__('Step 2'))
->schema([
...
]),
])
->nextAction(fn (Action $action) => $action->alpineClickHandler('alert("Next step")'));
Wizard::make([
Wizard\Step::make(__('Step 1'))
->schema([
...
]),
Wizard\Step::make(__('Step 2'))
->schema([
...
]),
])
->nextAction(fn (Action $action) => $action->alpineClickHandler('alert("Next step")'));
13 replies