gmgarrison
gmgarrison
FFilament
Created by gmgarrison on 4/10/2024 in #❓┊help
Can I add a custom Livewire component to the Dashboard?
It's not a Widget and I don't see where to add a Component. Is it possible?
6 replies
FFilament
Created by gmgarrison on 4/9/2024 in #❓┊help
Custom Livewire widget giving "getSort doesn't exist" error
I'm trying to add my first custom Livewire widget to my admin panel. I've got one Eloquent query whose result is passed to the Blade view to be displayed in a table, but I just get an error that getSort doesn't exist. .... what does this mean? I don't have much experience with Livewire and I'm not sure if that's what's tripping me up here. My widget extends the Component class and literally just has a render() method inside it.
4 replies
FFilament
Created by gmgarrison on 3/19/2024 in #❓┊help
What do I return in an action action in a table?
I've got a custom action as below: Tables\Actions\Action::make('Admit') ->action(fn (App $app) => $app->admit()) The admit() method updates some internal data but doesn't return anything. The front-end hangs indefinitely and the console logs this error: Unhandled Promise Rejection: SyntaxError: JSON Parse error: Unexpected identifier "Array" Am I supposed to return something in a specific format?
2 replies
FFilament
Created by gmgarrison on 3/1/2024 in #❓┊help
Custom Field in a form that's display only
I've created a custom field and used it in a form to display some formatted information but if I try to edit and save a record, I get an error that the field is an unknown column. How do I tell Filament that a field doesn't need to be saved to the record?
5 replies
FFilament
Created by gmgarrison on 1/26/2024 in #❓┊help
Widget error - unable to find component
I used the command line to create a stats-overview widget, Enrollment. I did not create it tied to any resource and it's for the admin panel, the only panel I have. As expected, app/Filament/Widgets/Enrollment.php was created. I manually changed the file and class name to EnrollmentWidget (to avoid a name conflict with the Model), changed the getHeadersWidgets function in the Dashboard page, and emptied out the auto-discover and widget arrays in the config file. But when I load the Dashboard, I get an error: Unable to find component: [app.filament.widgets.enrollment-widget] Is this expecting a view I have not provided? Is it connected to the originally-named widget?
6 replies
FFilament
Created by gmgarrison on 1/15/2024 in #❓┊help
Post form to non-Filament controller from table builder? Using Action?
I've got a Filament resource tied to Application models which each belong to a User. I'm trying to make a Bulk Action that would take selected Applications, collect those User emails, and redirect to a non-Filament form to write an email to send them all. The non-Filament version of this would just collect the selected User ID's and save them in a hidden field on the page with the email form. Then the controller processing that email form would take the text of the email and marshal it with the appropriate email addresses into the mail API. Can I use a Bulk Action to replicate that behavior?
2 replies
FFilament
Created by gmgarrison on 1/2/2024 in #❓┊help
Placeholder with record data and link
I'm trying to use both HtmlString and a closure with the model but I'm not sure what the right syntax should be. This is the code I've got:
Placeholder::make('name')
->content(fn(Application $application): string => $application->applicant->fullName)
->url(fn(Application $application): string => route('profile', ['id' => $application->user_id, 'page' => 'payments']))
Placeholder::make('name')
->content(fn(Application $application): string => $application->applicant->fullName)
->url(fn(Application $application): string => route('profile', ['id' => $application->user_id, 'page' => 'payments']))
I realize that ->url is not a method on Placeholder elements, but I don't see how to use the HtmlString with the closure to get the content. Thank you!
5 replies
FFilament
Created by gmgarrison on 12/16/2023 in #❓┊help
How do I persist FileUpload's result?
I realize this is a simple question but I cannot find the answer. I've got a resource's Form with a FileUpload input. I've read the documentation but I can't for the life of me find any information about where/how to persist information about the upload to the database. I've already got a File model (which is the model that the resource's form is connected to) but don't know where to put any code in FileResource to handle the upload. Thank you!
13 replies
FFilament
Created by gmgarrison on 12/11/2023 in #❓┊help
Arbitrary values for table column
I've got a Resource component that maps to Auditions in my app. An Audition HasMany Dates which also HasMany Slots and those Slots have a user_id to indicate whether anyone has signed up for them. I want to add a column that displays the count of "sign ups" - slots with a non-null user_id. I've used ->counts for another column but I don't think the same syntax works for a 2nd order relation along with a condition. Starting from $this representing the Audition model, I can easily create the value I want to display but I don't know how to incorporate arbitrary code in the TableBuilder. Is that possible? Thank you!
9 replies
FFilament
Created by gmgarrison on 12/8/2023 in #❓┊help
Set initial value for hidden field
I'm new to Filament but experienced with PHP and Laravel. I saw in the FormBuilder documentation creating a hidden field (Hidden::make('token')) but I can't find any info on setting its value to a default. I tried ->fill but got an error about accessing the Component before it's initialized. What am I missing? Thank you!
12 replies