Alexandre
Click record without jumping
on your resource class, add this :
return $table->recordUrl(null)
https://filamentphp.com/docs/3.x/tables/advanced#record-urls-clickable-rows14 replies
Shared panel session
👋
I've similar case in my project (one panel for Users and another for admin and super_admin) and I wanted to use the same login form.
Here's how I did it (it may not be the best way, but it works 😅)
I use the method
canAccessPanel
in my User Model like this :
And in my web.php
route file I've made a little change for the base URL :
And I've made a little helper to manage the redirection :
So, from the same form and according to your role, you're directed to the right panel. 👍6 replies
Change the default "save and create another" label in modal form
Thanks for your answer.
In where method should I put this?
I can't find something related in the base ListRecords.php file.
I tried to use this method, but I don't think is the good one because nothing change :
10 replies
Wizard Form display a modal after submit instead a redirect
Perfect, I've found it 🥳
If anyone is looking to do the same, here's how I did it:
Go to
vendor/filament/filament/resources/views/resources/pages/create-record.blade.php
and copy the contents.
Create a new blade page in your view folder and paste the content you've just copied.
In this page, add your modal :
After that, on your create function in CreateRequest.php, just pass the event to open the modal and that it !
FilamentPHP is so much fun to use and even more fun to learn, I love it, and thanks for that! 🤩5 replies
Wizard Form display a modal after submit instead a redirect
Well, I may have an idea, but it's not that yet.
I redid the
create()
function in my CreateRequest.php
I copy/pasted all the methods and then removed this part:
Originally, I wanted to put an Action()
on it, but when I clicked on the button, nothing happened and the action didn't open (no error in the console).
So I was wondering, is it possible to create a view with the contents of the modal with the Blade component <x-filament::modal/>
and call it in the create method with this (instead of the redirect):
If this is possible, how do I add the view Blade component to the "CreateRequest" page of my resource?
A method in mount()?
Thanks in advance 🙂5 replies
$get() in Wizard Form is null
That's all right then, because you can't go on to step 2 if the "building" field is empty 👍
However, the
data_get
returns null
and I'm having a bit of trouble understanding why... Knowing that $livewire->data['building']
does return a result.
I guess it's having trouble finding the 'building' field but I've tried with '../' and '../../' and it doesn't make any difference. However, as expressed in my first message, I just have 2 steps with a repeater in the second.
I'm tempted to say that it's not too bad as long as $livewire->data is ok, but uh 🤷♂️13 replies
$get() in Wizard Form is null
Thanks for your feedback.
The docs specify that
$get
is scoped in the repeater when used inside.
When I do a dd($get)
, I only get the select input in the second step, but not all fields.
$livewire->data
return an array with all fields and their values.
If I do data_get('building', $livewire->data, '');
I've got an empty string in return.
Same with data_get('building', $livewire->data['building'], '');
and data_get('../building', $livewire->data['building'], '');
I guess using $building_id = $livewire->data['building'];
is valid?13 replies
$get() in Wizard Form is null
I found another way, but I don't know if it's a good one 🙃
So... I'd like your opinion. I use the Livewire component to retrieve the field value and perform the search. The result is as follows: And… It's work. Seem ok?
So... I'd like your opinion. I use the Livewire component to retrieve the field value and perform the search. The result is as follows: And… It's work. Seem ok?
13 replies
$get() in Wizard Form is null
Ok, I found that : https://filamentphp.com/docs/3.x/forms/fields/repeater#using-get-to-access-parent-field-values
So, I try to use this :
dd($get('../building'));
(with one "../", two and three) but same result.
Is there a way to DD the form structure?13 replies
Is it possible to format a new option created in a Select?
Hello all,
I finally figured out how to do it after a lot of research 😅
So, for my case I can use the getOptionLabelUsing method
$value
is the value of the selected option (= the ID model)
And there is it 🥳3 replies
Header action on section to go back on a specific step on a Wizard Form
Thanks to both of you for your response and follow-up 😇
@PovilasKorop I know that the buttons in the header are clickable and that we have the previous/next buttons. But, for the header buttons, I know that not everyone is likely to understand that it's clickable.
In my case, the request is to have an additional "Summary" step that summarizes the answers from the previous steps, with a "Edit" button that takes you back to the step where the fields are.
Following @ben9563 's reply, here's what I did:
In my last step and for each step I made a Section which contains the answers of the step. Something like this:
I then added an Action in the header with a particular view where I pass the step ID:
Then I create a Filament button with Alpine's click method to trigger the step change:
Voilà, voilà, just like that, everything works. Thanks again 😃
10 replies
How to put the resource creation link in the navigation of the panel?
Hey, great it's working thanks ! But it's weird because the active class was also set to the "All requests" item (generated via the RequestResource" class).
So I added this to RequestResource.php:
And add a new Item in my navigation for the ListRequest :
So now it's good. Thanks for your help 😃
5 replies