Wirkhof
Explore posts from serversUnable to restrict /es/admin path
I am using i18n Nuxt extension.
This is my code:
I can visit /admin and cannot visit /es/admin . That's great and as expected.
But I can visti both /admin/settings and /es/admin/settings. Which is not good.
How to use stars or regex or something to block every other subpath for /es locale/prefix?
6 replies
Is there a plan to integrate a mechanism to reflect saved changes for Cancel button in the SPA mode?
Let's say I am editting things in form and save them. Then I click the cancel button next to the save button.
I will be redirected/taken back to the listing page where the pagination and filters are still in place - which is nice.
What is not nice thought, is the fact that the things I saved in the form are not refreshed with the new values and I have to manually refresh the page.
Are there plans to include this functionality by default in Filament?
I guess it works like that in non-SPA mode but in SPA mode the data in the list view are stale.
2 replies
Carbrand::all()->pluck('carbrand_name', 'id') is causing incorrect integer value: '"2"' error
I have this in my select box in Form:
in the Form for create resource is causing this error on Save:
I guess it is trying to save a string instead of integer - which the column in migration is saved to.
How to force Filament to convert the id to integer when saving?
Is there any other way to do it without pluck?
4 replies
How to bring current record into canAccess() method code?
I managed to restrict the access to the edit user page with this code:
and it works.
However, I need a bit more custom logic that uses some values from the record I am trying to access.
And I am unable to use
$this->getRecord()
inside the code like:
I am getting this error:
Using $this when not in object context
Any idea how to access the record inside canAccess() method?6 replies
Redirect when entering a certain edit page in resource
I would like to know where in the resource file or edit page should I put a condition and what is the way to do it.
I need to check if the user can edit some record based on the record category.
I know how to hide the edit button, but the user can enter the id of the record manually in the url and edit it anyway.
My guess is it should be put in the Edit page of the resource.
But not sure how it should be done.
For simplicity, let's say we want to redirect user back to the listing or homepage when his id is 42.
How to do that?
33 replies
How to get panel id name?
How do I get it in the middle of a form or table or wherever?
I mean the example.com/>>>adminaltered<<</ part for your admin/panel.
I want to change it dynamically and not hardcode it in the prefix in the textfield. That's why I am asking.
6 replies
How to make the Save button not include custom form field in the saving process?
I have a separate "save" feature included in my custom code that is independent on the Save of the form.
It works great. I do what I want via wire:click, stuff is saved directly in the DB as I need.
When I leave the form and go to other parts of Admin panel, things are persisted in the DB without the need of pressing the Save button for this record.
Now, the problem arises when I am editing the record and press the Save button (the one for the whole form).
It messes up the saving of the custom form field. Not sure what it does, probably grabs some wrong values because of bad/stale wire:key or something... the point is that:
I do NOT want the Save button to save things in the db for this custom field.
I want to exclude this field from being saved with the Save button.
I set -
>dehydrate(false)
on my custom form field and it seems to be working as long as I press the Save button.
Then it saves weird things in that DB column.
If I remove ->dehydrate(false)
or just leave ->dehydrate()
I will get the Column not found
SQL error.
How to make Save ignore this custom field when updating/saving post?59 replies
Why isn't Tailwind work in Filament custom component view files?
This is my tailwind config file:
?
Normal blade files interpret everythign live as I change it. For example, in any liveview full compoenent when I do bg-fuchsia-500 it works but not in custom component files of Filament that have been generated to /resources/views/forms/components/mycomponent.blade.php
How to make it that Tailwind generates css from those clases when using npm run dev the same way as it's doing right now for normal liveview components outside of Filament?
3 replies
How to add a method to a custom component?
Currently I am getting this error:
when I try to run a custom method called
saveCarState
when clicking on a button like:
I have followed this:
https://filamentphp.com/docs/3.x/forms/fields/custom
and created the custom component files (component class file and blade view class) via this command:
I can do the blade view and create bells and whistles.
But, in this custom component, I would like to bypass the form actions Save, Cancel, etc. and trigger my own Livewire functions.
So, I added `wire:click="saveCarState" on one of my buttons.
And I expect that when the user clicks on this button the function saveCarState in the file (that was created by the artisan command):
will be triggered.
So, I added it there like:
But I am getting the error message as I said in the beginning.
How can I use Livewire method in my custom component?
Clearly I am doing something wrong here 😭9 replies
How to find out currently checked Checklist boxes?
EDIT FROM THE FUTURE: In retrospect this is related to the inconsistency of results when using $get in different parts of the code - even withing the same field for example you will get a different result for
dd($get('cars')
when using in ->action() and a different one when using in ->visible(). My guess it's because of different life times they are employed, but this is super frustrating.
I don't know how to get the current value of my checkbox list.
When I do:
I will get a list of keys and values.
But I don't know which checkbox is toggled on.
how to see the real what-I-actually clicked list of items?46 replies
I need a one liner to get from this [1, 2, 3] to ["1", "2", "3"]
I am grabbing ids from users:
and this will give me an array with integers like:
However, I need to make it like this:
so basically strings in an array, or perhaps json like format, right?
The questions is how to do that without a closure or multiple variables or foreach loop etc.
Basically I need a one liner to be able to stick it in default() or other form field related parts, etc.
I have tried
But the result is:
So, it encapsulate the whole array as a string instead of its elements.
Any idea how to elegantly solve this problem?
Can I perhaps cast somehow the pluck('id') into string during the get process? Or is there some trick how to do this easy?
14 replies
How to prevent showing Success notification on the Edit page?
I am using a custom button with a custom action on the Edit page.
And when pressed, it shows 2 notifications instead of just 1.
The first one is the classic Saved successfullly success message that is part of the save buttons.
The second one is the custom message of mine I put on the button.
Here is the custom-button's code I am using:
The problem is that not only the "It's pending" notification is shown, but also the "Saved successfully" notification toast as well.
How to disable that saved successfully message and show only the my custom notification message?
18 replies
How to hard page reload after Update button's action is done?
The current state of the Update button on the edit page is that it doesn't hard reload the page.
But I need that somehow.
How to do that? Basically I want that after the update the whole page is hard reloaded - like when you presse cmd + R or ctrl + R in browser.
23 replies