F
Filamentβ€’6mo ago
Gush

Adminpanel settings change in App

hello all, i need help understanding how can i dynamicly change a configuration in Adminpanel my example is
->passwordReset() and i want to have a toggle form to change this to either true or false what would be the best approach? Thank you
Solution:
for starters, don't use env() outside of a config file. You'll run into potential caching issues. try this ```php $panel...
Jump to solution
5 Replies
toeknee
toekneeβ€’6mo ago
->passwordReset(fn() => run a check / fetch where the setting should come from)
Gush
Gushβ€’6mo ago
i cant do this
->passwordReset(env('ENABLE_PASSWORD_RECOVERY', false))
->passwordReset(env('ENABLE_PASSWORD_RECOVERY', false))
error: UnexpectedValueException PHP 8.2.0 10.37.3 Invalid route action: [1].
Solution
awcodes
awcodesβ€’6mo ago
for starters, don't use env() outside of a config file. You'll run into potential caching issues. try this
$panel
->bootUsing(function(Panel $panel) {
if (checkPasswordRecoveryHere) {
$panel->passwordReset();
}
});
$panel
->bootUsing(function(Panel $panel) {
if (checkPasswordRecoveryHere) {
$panel->passwordReset();
}
});
Gush
Gushβ€’6mo ago
thank you for answering
->bootUsing(function (Panel $panel) {
if (config('passwordrecovery.enable_password_recovery')) {
$panel->passwordReset();
}
})
->bootUsing(function (Panel $panel) {
if (config('passwordrecovery.enable_password_recovery')) {
$panel->passwordReset();
}
})
is not working for me error: Route [filament.admin.auth.password-reset.request] not defined.
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
if (config('passwordrecovery.enable_password_recovery')) {
$panel->passwordReset();
}
return $panel
->default()
...
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
if (config('passwordrecovery.enable_password_recovery')) {
$panel->passwordReset();
}
return $panel
->default()
...
works (for now) πŸ™ƒ thank you again
awcodes
awcodesβ€’6mo ago
yea, it's too late in the cycle to do what I was recommending. Guess that works too. proper thing would probably be to extend the password classes to add your functionality there.
Want results from more Discord servers?
Add your server
More Posts
Alpine: Cannot read properties of undefined (reading 'nestable')We are using https://github.com/solutionforest/filament-tree for creating tree like structure of parHow to get Value from From action when requiresConfirmation ?I wann get value from form like roles value ok How I can do it palse ?Delete repeater items from UI and database at the same timeInside of the edit action of a relationmanager I have a repeater form. Everything is working correctfilter form - reset filter A when filter B is some valueI'm trying to reset a filter when another filter is set to a specific value. so when `has_lab_reporcan we add job when uploading large size files in file uploadThis is my code.. When i am uploading larger size its taking too much time and still not uploading aLivewire error after upgrading filament from 2.x to 3.xI have recently upgraded one of my project from Laravel 9.x to 10.x along with filament. I used the mutateTableDataBeforeFill in an relation managerI'm am trying to mutate some data in an relation manager that uses an oneHasMany table with an pivotHow modify create button labelI would like to rename the 'Create' button to 'Submit'. How can I achieve that, sir?Interface "App\Filament\AvatarProviders\Contracts\AvatarProvider" not foundI have created a file BoringAvatarsProvider.php in app/Filament/AvatarProviders/ and put there this:anyone help please, how to make filter table reactive?im using filter that chained like country state city, if im select the country, then the state filte