Jon Mason
Help with custom field
I have a custom input field that works great in any normal form, but in a repeater, whenever a value is entered into one item in a repeater, the same value is applied to the field in all the other repeater items as well. I suspect that it's related to the blade file, but I have no idea how to go about fixing it. Even some steps to take to investigate would be super helpful.
4 replies
Persisting repeater changes to DB (TableRepeter)
I have a somewhat complex repeater table where I'm populating the table with custom calculations essentially, so when I use the
relationship()
method, it doesn't work. What I need to do is in each repeater field's afterStateUpdated
method, I want to get the current row and save the changes to the database. It seems like this should be pretty straight-forward, but I think the repeater is relying on a pretty simple relationship and not designed for my use case? Either that or I'm just too dumb to figure it out.
I've tried various things trying to get the $component->getContainer()
and use that to get the ID of the row? I really just need to get the ID of the row, which is in my data, so if I could get the row data I'd be happy.
I tried passing in array $data
, array $arguments
, Repeater $component
, nothing seems to give me anything useful. What am I missing, because it seems like this should be easy.
3 replies
form with multiple fields using the same model property
I have a single amount field on my model, and another field that indicates whether the amount is a credit or a debit. I need to display this data in a form and I'm having trouble creating 2 form fields based on the same model attribute.
I'm using this to get my form data (for the sake of this question, i'm leaving out the logic that differentiates between debits and credits):
And then I want to display them in these form fields:
I can dd the fillForm method and I get the expected data, but it's not populating in the form fields. The only way I can get any data to populate in the form fields is to name the field the same as my model, and then it just seems to disregard the
fillForm
method.4 replies
TableRepeater / Repeater populating form
Trying to use the TableRepeater plugin and it's working great except I have rows in my database that I want to populate the form with, and I can't seem to get it to do that. I must be missing something. This is an edit modal action on a table row, if that's matters. So the user clicks the table row's edit button, which brings up a modal that should display all the line items of the parent row in the TableRepeater.
10 replies
conditionally required validation
This doesn't seem to be working:
I also want to be able to conditionally require if a field is visible, and this also doesn't seem to be working:
I've tried replacing the variables with just hard coded true/false values in case the variable wasn't getting set up right, but that's not working either.
2 replies
multiple widget filters on a dashboard?
How would I accomplish having filters within a widget card on a Dashboard page so that each widget can be filtered independently? Or maybe have a section that has one set of filters that controls a set of widgets, and another section that has a different set of filters for a different group of widgets? Is that possible? I'm envisioning a dashboard with multiple metrics, requiring different filters.
3 replies
multiple dashboards
i've read in the docs how to create multiple dashboards, but anytime I remove
Dashboard::class
from my pages()
method as instructed, the navigation item disappears, and the next page in in my app just basically becomes the default. I've tried different things to try and make the dashboard show up without being in the pages method, but I haven't been able to. I've gone and looked at the Dashboard base class in the Filament directory and can't glean from that how exactly I should be making this work. It's not entirely clear from the docs (or I'm dumb) how exactly you can go about creating multiple dashboards.
15 replies
Can't access tenant in Test class?
A simple test like this:
fails because it says it's missing the tenant parameter in the route. I've tried doing something like
Filament::setTenant(Team::factory()->create());
in my setup method, and various other things and can't seem to get it to either use a fake tenant, or to ignore the tenant entirely. This particular page doesn't even rely on tenancy, it just exists in a panel where tenancy is used.
Any ideas?6 replies
wire:keydown call alpine method
I see I can use
etraInputAttributes
to add wire:keydown.enter
to an input. The method provided there will call a component method in livewire, but what if I want to call a javascript method on the alpine component? Is there a way to do that?
5 replies
Flux?
This might be a super dumb question.....I was just watching Caleb Porzio's presentation at Laracon for Flux and it looks great (https://fluxui.dev/). Would there be a way (or a future plan) to incorporate the styling of flux into Filament while still taking advantage of the magic of creating forms with Filament? I realize Flux isn't even available yet, just wondering if there are any thoughts on that from the great folks working on/with Filament.
12 replies
odd form behavior on relationship
From reading through topics and the docs, I've gathered that in order to use a relationship on a form field, I need to use a form layout component and set the relationship.
I have a form in a page component that I'm not populating until the user clicks a button. I'm able to populate the form with what I've got right now, but when it comes time to save,
$this->form->getState()
returns one field but not the one with the relationship.
mount method:
method to populate form:
the form:
5 replies
dynamic form schema timing issue
I've got a form that should only be loaded when a user clicks on an item in a list (not on page load). To handle this I have
wire:click
in my blade file, which calls my loadRecent
method. This method loads the necessary data that drives which fields will be on my form. The form data is unknown until the user clicks an item, so having a form with a standard set of hidden fields isn't an option.
My issue is that $form->schema($this->getSchema())
seems to be getting called early in the lifecycle before when my data is populated as is evidenced by the logs referenced in the code below.
4 replies
form not rendering until 2nd click
I have a form that's not rendered until the user selects an item from a list, be design. Once an item is selected the form should load and be available when the user clicks another button within the item.
The form isn't loaded on the initial button click, it's just a blank modal with only the heading and the close button, no form. If I close out of the modal, then click on another item in the
$recentRecs
list, the form loads correctly.
In the list:
4 replies
Good course on testing?
Are there any good in-depth courses/deep dives on testing within the Filament ecosystem (or even just filament overall). The only course on Filament that I've really seen (aside from just random youtube videos) is on Laracasts, and it's good, but looking for more resources.
5 replies
Render Hook for inserting livewire custom page into user menu?
I have several panels, and some pages are shared between panels, so I have the panel directories, and then I have a shared directory where all the pages/components live that are used in multiple panels.
I want to add a link to a user settings page, and since it will be shared, I want to put it in this shared directory. However, when I create a custom page class like I have with a lot of other use cases, and I use the
I can do this, I think, but just thinking there must be a better way.
userMenuItems
method on the panel provider, I get a route not defined error and I can't seem to get past it.
my custom page class:
2 questions:
first, am I doing something wrong that would allow me to just make this work the way it's laid out above? I don't know why I can't just link to whatever page I want to, whether it's in the panel or not (I'm guessing that's the problem).
With the other pages I have that are shared, I have a custom sidebar navigation where I'm creating the NavigationItem
s manually. This is the first time I've tried to put one of these in the user menu.
second, if the above isn't going to work, is there a way to maybe use a renderhook to put a link in my user menu.I can do this, I think, but just thinking there must be a better way.
6 replies