Akshay Bokade
Akshay Bokade
FFilament
Created by Akshay Bokade on 2/12/2024 in #❓┊help
loosing RepeatableEntry data when click on action
I have a repeatable entry in Infolist. Also, I have an action, calling a function validating some conditions. So when conditions fail, I am keeping the user on the same page. But the data of RepeatableEntry is getting erased. Please check the code given in the attachment.
1 replies
FFilament
Created by Akshay Bokade on 1/11/2024 in #❓┊help
Loosing data after clicking on custom action.
I have created custom action in for my table like, Action::make('late_cancellation_at') ->requiresConfirmation() ->action(function (array $data, $record) { $record->late_cancellation_at = now(); $record->status = 'cancelled'; $record->save(); }) ->visible(fn (Model $record) => $record->status !== 'cancelled'), Now when I click on this action all the data present in my table is getting lost. Note: I have modified index in getPages() and parameters in getUrl like, public static function getPages(): array { return [ 'index' => Pages\ListCoachingSessions::route('{lineItem}'), ------- ------- ]; } public static function getUrl(string $name = 'index', array $parameters = [], bool $isAbsolute = true, ?string $panel = null, ?Model $tenant = null): string { if (!isset($parameters['lineItem'])) { if(request()->lineItem) { $parameters['lineItem'] = request()->lineItem; } else { $url = request()->server('HTTP_REFERER'); $pattern = "/\/coaching-sessions\/([\w-]+)/"; preg_match($pattern, $url, $matches); if(isset($matches[1])) { $parameters['lineItem'] = $matches[1]; } } } return parent::getUrl($name, $parameters, $isAbsolute, $panel, $tenant); }
1 replies
FFilament
Created by Akshay Bokade on 11/6/2023 in #❓┊help
Restore action test not working
I am writing tests for relation manager's soft delete functionality. The RestoreAction is somehow not working. it('can restore contact', function () { $admin = Admin::factory() ->has(Contact::factory()->count(1)) ->create(); $contact = $admin->contacts->first(); livewire(ContactsRelationManager::class, [ 'ownerRecord' => $admin, 'pageClass' => EditAdmin::class, ]) ->mountTableAction(DeleteAction::class, $contact) ->callMountedTableAction(); livewire(ContactsRelationManager::class, [ 'ownerRecord' => $admin, 'pageClass' => EditAdmin::class, ]) ->mountTableAction(RestoreAction::class, $contact) ->callMountedTableAction(); $this->assertDatabaseHas(Contact::class, [ 'id' => $contact->id, 'deleted_at' => null, ]); });
3 replies
FFilament
Created by Akshay Bokade on 10/27/2023 in #❓┊help
How to write tests for create, edit and delete actions of Relation managers
This is what I am trying it('can add contacts', function () { $admin = Admin::factory()->create(); $contact = Contact::factory()->make(); livewire(AdminResource\RelationManagers\ContactsRelationManager::class, [ 'ownerRecord' => $admin, 'pageClass' => EditAdmin::class, ]) ->set('form', [ 'first_name' => $contact->first_name, 'last_name' => $contact->last_name, 'email' => '[email protected]', 'mobile' => $contact->mobile, 'phone' => $contact->phone, ]) ->call('create') ->assertSee('Contact created successfully'); }); and getting following error Error: App\Filament\Resources\AdminResource\RelationManagers\ContactsRelationManager::form(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /Users/xxxx/myfila/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php on line 54
5 replies
FFilament
Created by Akshay Bokade on 9/15/2023 in #❓┊help
Copy contents of first repeater fields to another
I am creating form having address fields of users. Each repeater item contains address fields of one user. Now I want to create a button which will copy the data of address fields from first repeater item and paste it into relevant fields of other repeater. As per my understandings, we need copy the state of fields that I wanted, but can't figure out how do I copy and paste it to other fields.
11 replies
FFilament
Created by Akshay Bokade on 9/14/2023 in #❓┊help
how can I hide a form field in first repeater
I want one field to be hidden in first item of repeater.
14 replies
FFilament
Created by Akshay Bokade on 8/22/2023 in #❓┊help
Unable to locate a class or view for component [filament-actions::modals].
I built a filament plugin in version 2. Now I have upgraded it to v3. After making some adjustments, everything is working fine except tests. I am getting following error while running tests Error: Unable to locate a class or view for component [filament-actions::modals]. (View: /Users/akshay/sites/email-templates/vendor/filament/tables/resources/views/index.blade.php) (View: /Users/akshay/sites/email-templates/vendor/filament/tables/resources/views/index.blade.php)
3 replies