X7Ryan
Define Form Data Mutation in One Place?
Quick question. I have a simple resource (using modals for creating and editing) and I need to mutate the data from the form before it is saved. I know I can pass a closure to
mutateFormDataUsing()
from the create/edit actions but that requires me to define the mutation in 3 places (the edit action, the create action on the manage page, and the create action under the empty state actions). Is there a way to define it once to apply to all create/edit actions (like maybe defining it under the field itself in the form schema definition?)3 replies
Add custom data when creating using Table Create Action with Relation Manager
I need to add some custom data to the user's input before saving when creating a new entry from the Table Create Action. Specifically I want to add the current users ID.
I tried using the
using()
method but that seemed to break other things. Specifically I am creating from a Relation Manager and the using()
method means it does not get the parent record ID when creating.
Is there another approach that will work with a Relation Manager like this?2 replies
Light/Dark mode switcher outside of Filament
Random non-filament filament question. Has anyone extracted the filament light/dark mode toggle to a package for a regular Laravel app? Or does it maybe already exist in a blade component I can use outside of filament if filament is installed? I have a Jetstream app that also has Filament v3 installed for the admin backend.
3 replies
Table combine multiple values into one column with multiple rows
I know at a minimum I could do a custom view column to make this work. Just curious if I can do it without having to define a view. I want a table column that combines multiple database columns into one and splits it across multiple lines. For example I have the following Database columns:
* address_1
* address_2
* city
* state
* zip
* country
and I want to compose them to one table column showing a properly formatted address like:
Address 1
Address 2
City, State Zip
Country
I was trying to set address_1 as the table column and make the description using the other columns, but I could not figure out a way to make line breaks work in a description.
If I could just define line breaks in a description that'd be perfect. I'd probably end up using that in a few places to be honest.
16 replies
[V3] Multitenancy - HasTenants Contract canAccessTenant() method
I am implementing Multitenancy in a new V3 app. The docs make no mention of the canAccessTenant() method but it is part of the HasTenants Contract with Tenant parameter and a bool return. I assume that is supposed to return whether or not the current user instance belongs to the tenant identified in the parameter? Seems like a reasonable assumption, but I just want to see if someone who knows for sure can confirm this before I submit a PR for the docs on this.
6 replies