Willy
Willy
Explore posts from servers
FFilament
Created by Willy on 10/4/2024 in #❓┊help
Open modal on page load
I saw that it is possible to execute an action when the page is loaded https://filamentphp.com/docs/3.x/panels/pages#opening-an-action-modal-when-a-page-loads There he gives the example of passing the action through the url
/admin/products/edit/932510?action=onboarding
/admin/products/edit/932510?action=onboarding
I didn't find it in the doc, but I saw that I can do the same for a table action if I pass tableAction instead of action. My question is, how do I pass the 'record' argument to my edit action?
3 replies
FFilament
Created by Willy on 8/28/2024 in #❓┊help
Testing Repeater
I'm testing a repeater, and for some reason I get a distinct validation error.
it('should show an error when the email is duplicated in the form', function () {
Repeater::fake();

actingAs(User::factory()->create());

$team = Team::factory()->create();
Filament::setTenant($team);

livewire(Members::class)
->fillForm([
'emailAddresses' => [
['email' => '[email protected]'],
['email' => '[email protected]'],
],
])
->call('create')
->assertHasFormErrors([
'emailAddresses.0.email' => 'distinct',
'emailAddresses.1.email' => 'distinct',
]);
});
it('should show an error when the email is duplicated in the form', function () {
Repeater::fake();

actingAs(User::factory()->create());

$team = Team::factory()->create();
Filament::setTenant($team);

livewire(Members::class)
->fillForm([
'emailAddresses' => [
['email' => '[email protected]'],
['email' => '[email protected]'],
],
])
->call('create')
->assertHasFormErrors([
'emailAddresses.0.email' => 'distinct',
'emailAddresses.1.email' => 'distinct',
]);
});
Repeater::make('emailAddresses')
->label(__('filament/clusters/settings/pages/team/members.form.repeater.label'))
->minItems(1)
->maxItems(5)
->defaultItems(1)
->deletable(fn($state) => is_array($state) && count($state) > 1)
->reorderable(false)
->addActionLabel(__('filament/clusters/settings/pages/team/members.form.repeater.addActionLabel'))
->simple(
TextInput::make('email')
->required()
->placeholder('[email protected]')
->email()
->distinct()
->unique(Invitation::class),
),
Repeater::make('emailAddresses')
->label(__('filament/clusters/settings/pages/team/members.form.repeater.label'))
->minItems(1)
->maxItems(5)
->defaultItems(1)
->deletable(fn($state) => is_array($state) && count($state) > 1)
->reorderable(false)
->addActionLabel(__('filament/clusters/settings/pages/team/members.form.repeater.addActionLabel'))
->simple(
TextInput::make('email')
->required()
->placeholder('[email protected]')
->email()
->distinct()
->unique(Invitation::class),
),
1 replies
FFilament
Created by Willy on 6/10/2024 in #❓┊help
Populate Repeater
No description
3 replies
FFilament
Created by Willy on 2/28/2024 in #❓┊help
Specify a directory when creating a resource
Does anyone know if it is possible for me to specify in which directory I want the resource to be created? Inside the Resources folder I have two other folders, one Admin and one App, how can I say that I want a resource to be created in the App directory?
3 replies