Davide Cariola
Htmlable label - illegal offset type
Hello, everyone.
I'm having a little problem with label(). My goal would be to replace the label text with a small image (a google logo).
The problem is that when I try to use a new HtmlString as the label value, it returns an error like ‘Illegal offset type’ no matter what I enter.
As soon as I enter a normal string instead, everything is fine.
I also found this example online:
but I can't figure out what the problem is. Is it possible that it does work only on Forms?
Thank you all very much for your support 😄
10 replies
Filter's query returns collection but table stays empty
Hi everyone, I am experiencing strange behaviour from one of my filters.
I have created a mix-max field, where I basically go and filter my records by minimum and maximum price. The query works through a normal when, with 2 different options: if a minimum price is entered and if a maximum price is entered.
This way, when the maximum price was deleted from the input, the table returned nothing.
So I thought of creating a third option: i.e. if the maximum price is null it returns all records with price <= the maximum possible price (obtained through a db query), but nothing has changed.
I've done some dumps and actually the code enters the when and, doing a dump of $query, the where exists; doing a dump of $query->get() I get the records I expect (i.e. all of them); the problem is that anyway the table remains empty.
4 replies
Go to different step based on field value
Hi!
I'm working on a wizard and I have to redirect the user to different steps based on the value of a specific field.
Could not find anything in the docs or here. Every kind of hint will be pure gold.
In the docs I found this: https://filamentphp.com/docs/3.x/forms/layout/wizard#customizing-the-wizard-action-objects and I thought it could be useful, but for now I can't figure out how.
3 replies
Repeater MorphToMany
Hi everyone!
I'm having a rough time with managing a MorphToMany relationship with a repeater. I'm currently managing permissions, roles and users.
Model/Permission.php
Model/User.php:
Model/Role.php:
Logic works fine, except the Repeater. I followed this documentation: https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship
and created the pivot class:
and in Model/Permission.php:
2 replies
Notification instead of 403 error page
Hi everyone!
As I'm working with roles and permissions, I have a lot of action that can and cannot be done depending on the user and its role.
Is it possible to get that, instead of triggering a 403 error (from a gate or other policy), a notification with the message "Unauthorized" is triggered?
I imagine it can be done by managing Notifications in the various actions, but I would prefer to write it once and have it work for all cases.
Thank you very much for the support!
9 replies
Get record values in Livewire component with Filament Table
Hello everyone. I have inserted a Filament table inside a Livewire component.
One of the fields is of type TextInputColumn, but I would like the same to have the disabled() option at a certain condition, which though depends on the value of the selected record.
Can this be done? Unfortunately, I could not find any details about it.
Here's my code and my idea:
Obviously, for now
$record->slug
returns an error.
Thank you!6 replies
EditAction and ViewAction doesn't work on livewire-table
Hi everyone! I used a livewire-table to show different roles.
I'm having issues with the EditAction and ViewAction: when I click on edit, the loader starts and, when finished, I get a "saved" notification. When I click on view, nothing happens.
The wierd thing is that the DeleteAction works as intended.
This is my code:
I also tried to use the
getPages
method from the resource. Thank you so much for the help.3 replies
relation manager authorization
Hi everyone!
How can I authorize a user to interact with a Relation Manager?
I have a project where roles are related to permissions, and in the edit of the permissions, I inserted a RolesRelationManager.
By implementing a RolePolicy (even setting to all simply return true), I no longer see the structure in the permission edit.
In the documentation I cannot find how I can handle this permission.
Thank you so much for every help
2 replies
Daisy UI on a Livewire component to use in a custom page
Hi everyone!
I'm trying to apply base tailwind classes and Daisy UI ones in a Livewire component used in a custom page.
I've read the previous conversations about it, created a custom theme, but I can't seem to make it work.
This is my vite.config.js:
This is my tailwind.config.js:
My AdminPanelProvider:
])->viteTheme('resources/css/filament/admin/theme.css');
My component:
Both bg-orange-500
(default tailwind) and btn btn-primary
(daisy ui) don't work.
I've run npm run build
and have npm run dev
active. I receive the daisy ui message when building the assets.
I also notice that if in my tailwind.config.js lives plugins: [require("daisyui")]
, come colors from the side bar disappears
Thank you so much for every help.4 replies