Sauravisus
Sauravisus
FFilament
Created by Sauravisus on 1/9/2024 in #❓┊help
Display all translations
Turns out https://filamentphp.com/plugins/mvenghaus-translatable-inline exists, and is perfect for my usecase.
6 replies
FFilament
Created by Sauravisus on 1/9/2024 in #❓┊help
Display all translations
So far I've got this:
foreach($locales as $locale){
$schema[] = TextInput::make("name")
->label(__('general.Name') . " - " . $locale)
->formatStateUsing(function ($record, $state) use ($locale) {
return $record->getTranslation('name', $locale);
})
->required();
$schema[] = TextInput::make("synonyms")
->label(__('general.Synonyms') . " - " . $locale)
->formatStateUsing(function ($record, $state) use ($locale) {
return $record->getTranslation('synonyms', $locale);
})
->required();
}
foreach($locales as $locale){
$schema[] = TextInput::make("name")
->label(__('general.Name') . " - " . $locale)
->formatStateUsing(function ($record, $state) use ($locale) {
return $record->getTranslation('name', $locale);
})
->required();
$schema[] = TextInput::make("synonyms")
->label(__('general.Synonyms') . " - " . $locale)
->formatStateUsing(function ($record, $state) use ($locale) {
return $record->getTranslation('synonyms', $locale);
})
->required();
}
And while it does make the fields for each of my locales, for some reason the translation obtained is the one for my applanguage, not the locale we're currently on in the loop. I'm quite confused as to why that'd be the case.
6 replies
FFilament
Created by Sauravisus on 1/9/2024 in #❓┊help
Display all translations
Would I have to do a loop based on the languages used, to output the amount of TextInputs for each thing?
6 replies
FFilament
Created by S. Mert ÖZTÜRK on 10/18/2023 in #❓┊help
how to, livewire form save button to header in filament custom page
Alternatively, the one and only Dan Harrin just shared a solution to putting the submit button into header actions over here: https://discord.com/channels/883083792112300104/1166754657310355456/1166766327072051241
11 replies
FFilament
Created by Sauravisus on 10/25/2023 in #❓┊help
Adding a save button to EditPage header
For others trying to replicate adding a save button to the header:
Action::make('save')
->label('Save changes')
->action('save'),
Action::make('save')
->label('Save changes')
->action('save'),
Toss that into your getHeaderActions array, and you're off to the races. 👍
11 replies
FFilament
Created by Sauravisus on 10/25/2023 in #❓┊help
Adding a save button to EditPage header
Ah, yep. It does. Can't just slap the action onto the OG save action, gotta be a new one.
11 replies
FFilament
Created by Sauravisus on 10/25/2023 in #❓┊help
Adding a save button to EditPage header
Right in here @Dan Harrin. At least that's the current incarnation. Does it have to be a wholly custom action to work, maybe?
11 replies
FFilament
Created by S. Mert ÖZTÜRK on 10/18/2023 in #❓┊help
how to, livewire form save button to header in filament custom page
That'd move it outside the form and make it non-functional. I'm trying to find a solution to the same problem. 😅
11 replies
FFilament
Created by Sauravisus on 10/15/2023 in #❓┊help
TextColumn vanishes when using dot notation
No worries, man. I'm just glad it isn't me going bonkers. 😂
10 replies
FFilament
Created by Sauravisus on 10/15/2023 in #❓┊help
TextColumn vanishes when using dot notation
Thanks @archilex!
10 replies
FFilament
Created by Sauravisus on 10/15/2023 in #❓┊help
TextColumn vanishes when using dot notation
Hah, it was. Grabbing 3.2.4 with composer update fix'd the issue. 😄
10 replies
FFilament
Created by Sauravisus on 10/15/2023 in #❓┊help
TextColumn vanishes when using dot notation
It might be, as it was working a few days ago. 😂
10 replies
FFilament
Created by Sauravisus on 10/15/2023 in #❓┊help
TextColumn vanishes when using dot notation
I tried working around this, by making a new column and then loading in the data in another manner, but uh, that resulted in the url part working, but no text being displayed, even if I did formatStateUsing()
10 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Is there a way to add pagination to a repeater component?
That's the weird part. This is on my table in the relation manager:
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
]);
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
]);
But they don't show up in the table at all. I do have policies on my resources and whatnot, but I'm on a user with a role that gives access to everything
9 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Is there a way to add pagination to a repeater component?
Yeah that makes sense. I've replaced my repeater (and the insanity of the toggle switch) with a Relations Manager. Now I've got a follow-up question: How the heck do I add a delete button to the modal that pops up? For some reason my only option for deleting is via bulk actions. I've got no delete button in the table itself, or in the modal that shows up when clicking an entry.
9 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Toggling editability on fields in a repeater
So, for others trying to do insanity like me: Remember that inside repeaters you gotta use ../../ if you wanna use $get - This is covered in the documentation here: https://filamentphp.com/docs/3.x/forms/fields/repeater#using-get-to-access-parent-field-values
20 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Toggling editability on fields in a repeater
Aaaand that's covered in the docs. Got it working. 😄
20 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Toggling editability on fields in a repeater
Further investigation has revealed to me that the $get I've been using there apparently can't fetch data from outside the repeater.
20 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Toggling editability on fields in a repeater
Oh. That was my JS that I forgot to remove. Whoops.
20 replies
FFilament
Created by Sauravisus on 10/14/2023 in #❓┊help
Toggling editability on fields in a repeater
So I tried with the toggle again, without ->live(), and now it does seem to toggle when using ->disabled(fn (Get $get) => $get('unlock_fields') !== true) and ->hidden(fn (Get $get) => $get('unlock_fields') !== true) - but the checkbox isn't actually being shown, just the container for it. Using ->live() briefly unlocks the textarea and shows the container for the checkbox, but half a second later it's like it was toggled back to the original state.
20 replies