Aman
Issue with FilamentSpatieTranslatable plugin LocaleSwitcher not saving record after v 3 upgrade
Yes Working fine it
->rules([
function (?Blog $record, $livewire) {
return function (string $attribute, $value, Closure $fail) use ($record, $livewire) {
// Ensure Livewire component has the activeLocale property
$locale = $livewire->activeLocale ?? config('app.locale');
if (!$locale) {
$locale = config('app.locale'); // Fallback to default locale
}
// Debugging: Uncomment to check locale value
// dd($locale);
if (Blog::query()
->where('id', '!=', $record?->id)
->where("title->{$locale}", $value)
->exists()
) {
$fail(__("This :attribute already exists in the selected language: :locale", [
'attribute' => Str::replace('data.', '', $attribute),
'locale' => strtoupper($locale)
]));
}
};
},
])
11 replies
Issue with FilamentSpatieTranslatable plugin LocaleSwitcher not saving record after v 3 upgrade
I solved by this is there any another way or will work according selected lang?
->rules([
function () {
return function (string $attribute, $value, Closure $fail) {
$locales = ['en', 'de']; // List of supported locales (can be dynamic)
foreach ($locales as $locale) {
$existing = Blog::where("title->{$locale}", $value)->exists();
if ($existing) {
$fail(__('This title already exists in: ' . strtoupper($locale)));
break; // Stop checking after the first duplicate
}
}
};
},
])
11 replies
Issue with FilamentSpatieTranslatable plugin LocaleSwitcher not saving record after v 3 upgrade
How can i use here for unique title is i selected de by select drop down not working ?
i Mean validation not work
https://prnt.sc/Nuf2lE0oVyJ_
->rules([
function (Forms\Get $get) {
return function (string $attribute, $value, Closure $fail) use ($get) {
$locale = $get('activeLocale'); // Get selected language from Filament's LocaleSwitcher
dd($locale);
if (!$locale) {
$locale = config('app.locale'); // Fallback to default locale
}
// Check uniqueness in the specific language field (title->en or title->de)
$existing = Blog::where("title->{$locale}", $value)->exists();
if ($existing) {
$fail(__('This title already exists in the selected language: ' . strtoupper($locale)));
}
};
},
])
11 replies
Too many login attempts Not work.
How can I override the login attempt limit to allow only 3 attempts?
I believe it requires modifying the configuration values. Specifically, I found this method in my code:
public function authenticate(): ?LoginResponse
{
try {
$this->rateLimit(5);
}
}
Currently, it seems to allow 5 attempts, but I want to restrict it to 3.
Does anyone know how to properly override this setting? Should I modify it in the config file or is there another way to implement it correctly?13 replies