Trauma Zombie
Explore posts from serversHow to validate Select relation field?
Hi guys, I have 3 simple models: Organization, Store, Contact. Each Contact can be assign to Store only of his own Organization. I want to use Select field with multiple option, but I need to validate that the stores saved in belongs to organization of that contact.
This works just fine, but user can select Organization first, then select some Stores, then change organization and click save. It will save organization with stores that dont belongs to that organization.
7 replies
Confirm model for option inside SelectField?
Hi guys, I have Select field at the beginning of my form for resource. When user selects an option from this field, it fill fill many other fields in that form. It works just fine. But now I need to show confirmation modal when these other fields are already filled, so user has to confirm to update these fields. For the filling these fields, I am using afterStateUpdated hook. But I am not sure if there is an option to show confirmation modal.
1 replies
Loading wrong model on infolist
Hey guys, I found some strange behavior in my app and I can't help it.
I am trying to load all direct children and authenticated user here:
Inside my users table I see 3 users: Parent (auth one), Child 1 and Child 2. When I click on parent or child 1, I see infolist for these models, but when I click on child 2 it still give me infolist with child 1. Although I can see child id 2 in the url.
I am using this package: https://github.com/staudenmeir/laravel-adjacency-list
Can you help point me in the right direction?
2 replies
Where to send notification after relationship created
Hi guys, I have two simple models: Task and User. There is belongsToMany relationship between these two. In my Task resource I have Select::multiple() and also UsersRelationManager. In User resource I have TasksRelationManager. I want to send notification each time new user is assigned to task. Where do you suggest to place this part? I tried it inside TaskObserver on created method, but Filament is saving relationships after first commit, so there is no $task->users on created method.
3 replies
How to correctly typehint or set return types for IDE support and autocomplete?
Hi guys, I create small macro for all fields and entries:
But I still have these warnings:
Method 'hintIcon' not found in FilamentServiceProvider|\Filament\Support\Components\ViewComponent
Method 'warningHint' not found in \Filament\Forms\Components\Toggle
4 replies
How to disable toggables on table?
Hi guys, I have multiple resuable columns, but on some tables I want to disable toggability of that table. I know, I can set
$table->searchable(false)
to disable searchbar, but how to disable button for toggling columns on table (not on separate columns)?7 replies
Notify user assigned or detached using Select
Hi guys, I have model Task and model User.
Then I have this select component inside TaskResource:
Is it even possible to notify only assigned or detached users using this Select? I probably know how to do that via relation manager and button Attach and Detach, but I want to do it via this Select.
4 replies
Relationship not saved when using createOptionUsing on Select input
Hi guys, I am trying to create subject via select input with createOptionForm. Inside that form is another relationship (seller), that is not saved when I chain createOptionUsing method. When I remove that method seller relationship is saved correctly, but I also need to save broker_id (user) to that subject, thats why I use createOptionUsing method. Can you help me?
2 replies
Stream PDF to response
Hi guys, can you help me stream PDF to response directly from action? Is it even possible? Should I save my PDF firstly?
I am using Spatie Laravel PDF:
https://spatie.be/docs/laravel-pdf/v1/basic-usage/responding-with-pdfs
2 replies
How to set value to createOptionForm from another field?
Hi guys, I need a little help from you. This is part of my contract form. I have two selects: broker and client. For client select I have createOptionForm for modal creation of client. When I set broker_id in first select I want to use it as broker_id in the createOptionForm. I dont know how. Right now, it will probably get value from the same hidden input. It is null on fill, so it gets null.
2 replies
Reusable sections
Hi, I was wondering how you usually create reusable parts for example e.g. infolists or forms? For example I create my own
AddressEntry
that I am using on multiple resources. The problem comes when I need to access the Address model.
This is my demo custom entry:
Model in my closure in url method is taken from resource, when I use it on UserResource, it is User etc.
It kinda works, but I don't like this implementation. Do you know better way?27 replies
How to pass record to table row action?
Hi guys, I am trying dynamically create actions for my table rows:
I am still getting this error:
Too few arguments to function App\Filament\Resources\ContractResource\Pages\ListContracts::App\Filament\Resources\ContractResource\Pages\{closure}(), 0 passed in /Users/me/Developer/Sites/leasing/app/Filament/Resources/ContractResource/Pages/ListContracts.php on line 91 and exactly 1 expected
5 replies
Conditional steps on wizard
Hi guys, is it possible to make conditional steps on wizard?
Right now I have this wizard on my CreateClient component:
Problem is, when I select company as a type in general step, after clicking next button it will jump to Attachments step and skips steps Company and Representative.
2 replies