prouse_
prouse_
FFilament
Created by prouse_ on 11/9/2024 in #❓┊help
Same field in all forms/resources
Let's say we have a Select Field for selecting company in 90% of our forms. Same for table column. Is there anyway to avoid repeating the code. Either by doing some CompanyForm that already has it in the schema, somehow using a trait, making a custom Resource such as CompanyResource which we extend. I cannot really find the best or most appropriate solution for this. Anyone experienced anything similar and have any suggestions on how to best solve it?
9 replies
FFilament
Created by prouse_ on 10/20/2024 in #❓┊help
Table Records that don't exist in database
Hi! I have a RelationshipManager where I want to display records even though they do not exist in database. Basically I have an enum of modules and I want to show them all in the relationship table whether the user has the relationship or not. If they have it, it should have an edit action. If they don't have it they should have an install button. I have tried the following solutions: 1. Overriding getTableRecords and getRecordKey. This way I can make a custom eloquent collection which is merged one with the actual database records and the non-database ones. However, when clicking an action it wont work since Filament seems to use the query to fetch the record and since the record does not actually exist in the database nothing happens. This solutions could probably work by overriding even more methods but that does not feel right. 2. Trying to make some kind of custom query that makes a sub query in the database and returns records that doesn't exist. Haven't managed to get this working though. Anyone have any ideas on how to solve this? Anyone faced any similar issue? Any help is appreciated!
1 replies
FFilament
Created by prouse_ on 10/6/2024 in #❓┊help
Admin and super admin
We have admin and super admins. For some resources super admin has access to some additional columns which regular admins don't have. Super admins also have a few resources which admin don't have at all. Currently we're controlling this with if statements inside the resources which checks what kind of user it is. However this becomes clutterly with lots of if statements and also has a high risk of accidentally putting a super admin column visible for a regular user since it's all in same file. We want to somehow seperate the files completely so the code is more clear and no risk of mistakes. What is the best approach here? Is multi panel the best way to go? Is it possible in that case to have a base resource with the common columns and then extend that for the specific columns? Or how do we avoid duplicate code? Any help or guidance is highly appreciated!
18 replies
FFilament
Created by prouse_ on 2/8/2024 in #❓┊help
Access repeater data afterSave
I have a relationship repeater and inside it there is also a checkbox that doesn't really exist in the model. In the Edit Record Page I want to do some logic with all the items that had the checkbox checked after saving. $this->form->getState() won't return any of the repeater data. Probably because it's a relationship repeater which disables dehydration from what I can tell. And $this->data for some reason always returns false on the checkbox column even though it's checked. I'm assuming because it somehow, somewhere fetches/rehydrates the data from the relationship and since the column does not exist it gets null and else false. So my question is how can access the original data or somehow get all the items that had this checkbox checked?
9 replies
FFilament
Created by prouse_ on 11/17/2023 in #❓┊help
Disable tenant menu with tenancy
Is there any way to disable the tenant menu even though tenancy is enabled? The reason is that I want the to make a custom tenant menu in a custom location. How to best achieve this?
3 replies
FFilament
Created by prouse_ on 11/17/2023 in #❓┊help
Hook into before form schema
We have a form field that we want in 90% of all forms. Instead of manually having to add this to all form schemas I would like to find an automatic way to do this based on a certain condition. What would be the best way to achieve this? Have tried by extending classes etc but can't find a good solution to hook into the form schema and add fields in a parent class or so. Is there any other way we can hook in at the beginning or end of form schema? Or any other good solution that is SOLID? Any help is highly appreciated.
4 replies
FFilament
Created by prouse_ on 11/5/2023 in #❓┊help
Global form field
Is it possible to somehow create a global form field that shows up in all resources that implement a specific interface och trait? So you don't need to add it manually to each. For example let's say we want to make multiple different CompanyResources such as EmployeeResource and ScheduleResource. Both of them needs a company field but you only want to add it once instead of always having to add it to each resource you make. What would be the best way to achieve this?
4 replies