kennyhorna
Conditionally displaying delete action in a Repeater based on row
Hello,
My model has a "active" field that should enable/disable the deletion of the element in the repeater.
I know that there's a
->deleteAction(fn ($action) => ...)
function, but I haven't been able to figure out how to inject the current row. I tried with $state
but the whole repeater array is included instead.
Is there a way to accomplish this?11 replies
Problem when saving a record in a form that contains a table (custom filament Livewire component)
Morning 👋🏽
I have the following case.
Case
I have the
SaleTrackingResource
. This resource has a 1-M relationship with SaleDay
, that in turn, has a 1-M relationship with SaleDayEntry
.
- SaleTrackingResource
1-m SaleDay
1-m SaleDayEntry
Since I need to display the SaleDayEntry objects in a table in the SaleTrackingResource, I created a custom Livewire component, ListSaleDayEntries
. I extended the Livewire\Component
class and it implements the HasForms
& HasTable
interfaces.
It looks like this [Image 1].
How it's rendered:
In the SaleTrackingResource
, I have a section that renders the SaleDay
s dynamically. Each day will have a tab, and within that tab is that I make a new instance of the custom Livewire component I mentioned earlier, the ListSaleDayEntries
. This is the relevant code:
Problem
I will put the problem in reply below6 replies
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
Hello,
I want to refresh the main form/resource (or the whole page if possible) after a new entry has been created through a RelationManager of the resource.
This is my setup:
- Resource:
PriceListResource
- RelationManager: SectionsRelationManager
- Relationship name: sections
I have tried this so far:
1. RelationsManager/SectionsRelationManager.php
:
Then in the edit resource page I listen to that event:
2. PriceListResource/Pages/EditPriceList.php
The event/listener works (I added a dd()
in there and I can see it being triggered) but I can make it refresh the relationship. I guess because sections
is not an attribute per-se.
The reason why I need this is because within the form I have a TableRepeater that is built dynamically based on this relation.
Then, how could I achieve the refresh/re-render?18 replies
Set record in ViewRecord page
Hi, I'm creating a custom panel for a customer role. So I would like to limit the view/edit actions for this customer to only be able manage his/hers business.
So my idea is to create BusinessResource and then use the ViewBusiness to display the data using an infolist, so then I can add a new entry in the nav pointing to the view page directly.
My problem right now is that I cannot set the record in the view page.
So this is my
Business::getPages()
:
I've tried to set the record using this 3 methods but so far no luck:
But I'm still getting:
How could I achieve this? Or maybe some guidance in case there's an easier approach.
Thanks in advance 🙂9 replies
How to set default values (to persist) on repeater
Hi, I'm building a table to specify the opening hours of businesses. So, I want to populate a repeater with weekdays. Currently I'm doing this:
Which it display them fine, but when I want to persist the data -> the values of the
'day'
key (that is being handled on a Select
field) are not being passed (remain null
). Only when I manually clic on the select and change it -> they are included in the request.
How to include the values by default?
Thanks in advance.2 replies
Problem loading livewire.js on v3
Hi! I can't find a way to make to make it to work. I still see error 500.
I have tried to add the following to my site config (local, I'm using Valet)
Also, in Livewire v3 there's no asset_url option in the config but now this https://livewire.laravel.com/docs/installation#customizing-the-asset-url
Ps: I installed v3 beta (filament + livewire) from scratch.
Have you experiencie this? Thanks in advance.
5 replies