uendel
uendel
FFilament
Created by uendel on 10/15/2024 in #❓┊help
How to test the form of a relation manager?
I want to verifiy if one select field of my relation manager has the correct options, however I don't know how I can make this assertion. I've tried:
livewire(RelationManager::class, ['ownerRecord' => $record, 'pageClass' => ''])
->assertFormFieldExists(
'select_field',
checkFieldUsing: function ($field) {
$options = $field->getOptions();

expect($options)
->toHaveCount(1);

return true;
},
);
livewire(RelationManager::class, ['ownerRecord' => $record, 'pageClass' => ''])
->assertFormFieldExists(
'select_field',
checkFieldUsing: function ($field) {
$options = $field->getOptions();

expect($options)
->toHaveCount(1);

return true;
},
);
But this returns the error:
Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /var/www/html/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php
Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /var/www/html/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php
How can I test this?
2 replies
FFilament
Created by uendel on 10/8/2024 in #❓┊help
Is it possible to render the raw html of a form?
So I want create a pdf file with the form of a resource, I'm using Laravel domPDF, so I can inject the raw html there and the pdf file will be built however I'm not sure how to get the raw html from a resource
6 replies
FFilament
Created by uendel on 8/28/2024 in #❓┊help
How to test an Import Action and its Importer class?
I don't see any tips or good practices in the documentation on how to properly test this, do you guys have any suggestions on how I can tackle this?
3 replies
FFilament
Created by uendel on 8/23/2024 in #❓┊help
Is it possible to make the Checkbox element have its label before the input?
When creating a Checkbox element, it comes with the input before the label, I wanted to create it with the input after the label, I didn't see anyting on the documentation, is it possible?
6 replies
FFilament
Created by uendel on 8/21/2024 in #❓┊help
Dynamic select options don't work with native Select
I have a select that has options dependent on other field.
Select::make('person_id')
->native(false)
->searchable(false)
->options(fn () => self::$peopleOptions)
->visible(fn () => self::$foundMultiplePeople)
->label('Person'),
Select::make('person_id')
->native(false)
->searchable(false)
->options(fn () => self::$peopleOptions)
->visible(fn () => self::$foundMultiplePeople)
->label('Person'),
However this only works if the select is not native, am I doing something wrong?
3 replies
FFilament
Created by uendel on 7/13/2024 in #❓┊help
I can't change default create action's notification title
I have a simple createAction in a form, and I want to change the notification success title, I'm following the documentation https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create#customizing-the-save-notification, but this is not working on my listUsers class.
<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;

class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;

public function getTitle(): string
{
return trans('filament-user::user.resource.title.list');
}

protected function getActions(): array
{
return [
CreateAction::make()
->successNotificationTitle('User Created Successfully!'),
];
}
}
<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;

class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;

public function getTitle(): string
{
return trans('filament-user::user.resource.title.list');
}

protected function getActions(): array
{
return [
CreateAction::make()
->successNotificationTitle('User Created Successfully!'),
];
}
}
8 replies
FFilament
Created by uendel on 7/5/2024 in #❓┊help
How do I combine two actions into one?
I have two actions, one creates a user the other one invites a user, I want to combine them into a single one, so when a user gets created, they get invited right away too. Is it possible? I know I about the after hook but I don't know how to execute an action from there. One important thing to note is that both actions are from plugins so it wouldn't be nice to extract the code from the packages.
3 replies