Will 🇬🇹
Will 🇬🇹
FFilament
Created by Will 🇬🇹 on 3/28/2025 in #❓┊help
Prevent multiple calls to the same model
Appreciate you tacking the time to answer. I like to optimice my code and having stuff doing the same thing multiple time didn't make too much sense.
8 replies
FFilament
Created by Will 🇬🇹 on 3/28/2025 in #❓┊help
Prevent multiple calls to the same model
Why is not worth the hustle? Coming from a point of DRY and optimization, calling the same thing multiple times makes no sense but honestly I might be ignoring something
8 replies
FFilament
Created by Shaheen on 3/3/2025 in #❓┊help
Placholder component doesn't render state by default
Expected behaviour https://filamentphp.com/docs/3.x/forms/layout/placeholder Since they are used to render text-only fields they are not bind to a "property". So it makes sense to access the $record if thats how you want to use it
3 replies
FFilament
Created by angel87413 on 3/3/2025 in #❓┊help
Problems using Repeater in an action
Since your Repeater is tied to a ->relationship() it gets saved to the DB per item in your repeater. So it makes sense to only return the information of your current item. If you need to get information OUTSIDE your repeater you need to access it by injecting Get $get in your ->mutateRelationshipDataBeforeCreateUsing(function ($record, $data) { Like this
->mutateRelationshipDataBeforeCreateUsing(function ($record, $data, Get $get) {
// ../ <== tells filament to go UP once from the repeater
$otherField = $get('../client_id');
})
->mutateRelationshipDataBeforeCreateUsing(function ($record, $data, Get $get) {
// ../ <== tells filament to go UP once from the repeater
$otherField = $get('../client_id');
})
3 replies
FFilament
Created by Will 🇬🇹 on 3/3/2025 in #❓┊help
Build repeater schema from action
I got working. I was looking at this incorrectly 😢 schema is the "input structure" I just needed to pass the array on how this inputs were going to work with
>action(function (Get $get, Set $set, $action) {
$set('variations', [
'testing-1' => [
'name' => 'Testing 1',
'alias' => 'Awesome alias',
'sku' => 'SKU-1',
'regular_price' => 100,
],
'testing-2' => [
'name' => 'Testing 2',
'alias' => 'Awesome alias 2',
'sku' => 'SKU-1',
'regular_price' => 200,
],
'testing-3' => [
'name' => 'Testing 3',
'alias' => 'Awesome alias 3',
'sku' => 'SKU-1',
'regular_price' => 300,
],
]);
})
>action(function (Get $get, Set $set, $action) {
$set('variations', [
'testing-1' => [
'name' => 'Testing 1',
'alias' => 'Awesome alias',
'sku' => 'SKU-1',
'regular_price' => 100,
],
'testing-2' => [
'name' => 'Testing 2',
'alias' => 'Awesome alias 2',
'sku' => 'SKU-1',
'regular_price' => 200,
],
'testing-3' => [
'name' => 'Testing 3',
'alias' => 'Awesome alias 3',
'sku' => 'SKU-1',
'regular_price' => 300,
],
]);
})
3 replies
FFilament
Created by flex on 3/1/2025 in #❓┊help
Get Schema from Form for createOptionForm()I
I was running into this earlier today this should work
// option 1
->createOptionForm(fn(Form $form) => YourResource::form($form))

// option 2 if you need to change your form inside the createOptionForm
->createOptionForm(
function (Form $form) {
return YourResource::form($form))
}
)
->createOptionUsing(function (array $data): int {
// logic to create your record
return $newRecord->id
})
->createOptionAction( function (Action $action) {
// if you need to modify the modal
return $action
->modalWidth('md')
->modalHeading('Create modaul');
})
// option 1
->createOptionForm(fn(Form $form) => YourResource::form($form))

// option 2 if you need to change your form inside the createOptionForm
->createOptionForm(
function (Form $form) {
return YourResource::form($form))
}
)
->createOptionUsing(function (array $data): int {
// logic to create your record
return $newRecord->id
})
->createOptionAction( function (Action $action) {
// if you need to modify the modal
return $action
->modalWidth('md')
->modalHeading('Create modaul');
})
13 replies
FFilament
Created by Azad Furkan ŞAKAR on 11/21/2024 in #❓┊help
Changing Selected Item background and text color in Select input
Nice, I mean it could look a bit better but your approach is not bad at all 🙂 Maybe share your code to help other in the future
11 replies
FFilament
Created by Azad Furkan ŞAKAR on 11/21/2024 in #❓┊help
Changing Selected Item background and text color in Select input
No description
11 replies
FFilament
Created by Will 🇬🇹 on 6/27/2024 in #❓┊help
Call async JavaScript function from a Action
here is a quick demo, modal closes right away doesn't wait for the JS function to finish
3 replies
FFilament
Created by Cheesus Krays on 4/8/2024 in #❓┊help
How do I show the date
column is case sensitive so make sure to type it as is in your DB 'Created_at' shoul be 'created_at' So Tables\Columns\TextColumn::make('created_at') The other one not sure :/
6 replies
FFilament
Created by Will 🇬🇹 on 4/8/2024 in #❓┊help
How to get team_id when creating new record from Relation Manager
Thanks @tomc actually found probaly a safer way since Users can edit values in hidden fields
->headerActions([
Tables\Actions\CreateAction::make()->mutateFormDataUsing(function (array $data): array {
$data['team_id'] = Filament::getTenant()->id;
return $data;
})
])
->headerActions([
Tables\Actions\CreateAction::make()->mutateFormDataUsing(function (array $data): array {
$data['team_id'] = Filament::getTenant()->id;
return $data;
})
])
As mention in the docs - https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create#customizing-data-before-saving
5 replies