Bagus A
Bagus A
FFilament
Created by Bagus A on 5/31/2024 in #❓┊help
Using formatStateUsing on Select relationship
How can we, for example format a date with the source coming from a relationship? I've tried using formatStateUsing but it doesn't seem to work.
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('bucket_id')
->relationship(name: 'bucket', titleAttribute: 'date')
->required()
->preload()
]);
}
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('bucket_id')
->relationship(name: 'bucket', titleAttribute: 'date')
->required()
->preload()
]);
}
7 replies
FFilament
Created by Bagus A on 4/26/2024 in #❓┊help
Customize create label for Resource with ManageRecords
In normal resource with it's own create page, we can have getCreateFormAction method to customize the label of the create button, for example:
protected function getCreateFormAction(): Action
{
return Action::make('create')
->label('Add Customer')
->icon('heroicon-o-user')
->submit('create')
->keyBindings(['mod+s']);
}
protected function getCreateFormAction(): Action
{
return Action::make('create')
->label('Add Customer')
->icon('heroicon-o-user')
->submit('create')
->keyBindings(['mod+s']);
}
This method doesn't work for simple resource which extending ManageRecord without it's own create page. How do we customize the label in simple resource?
1 replies
FFilament
Created by Bagus A on 2/27/2024 in #❓┊help
How to apply default filter/query for a table
I have one table in DB that I would like to display on two resources based on it status. This might be achieved using filters, but filters can be changed and I want a dedicated page for some reason. I only find a way to enable default filter (https://filamentphp.com/docs/2.x/tables/filters#default-filters), but this is not what I'm looking for. How do we apply default filters by code without visible UI?
3 replies
FFilament
Created by Bagus A on 2/26/2024 in #❓┊help
Select Filter with Group By from Column not Relationship
I would like to create a SelectFilter using a column in a table. It's not a relationship so I need to do a query and pluck the name but the options field only accept hardcoded arrays. How do I query the fields inside options method?
4 replies
FFilament
Created by Bagus A on 2/26/2024 in #❓┊help
How to Reuse the Same DB Column in a TextColumn of Table
No description
4 replies
FFilament
Created by Bagus A on 2/25/2024 in #❓┊help
How to combine text and badge?
In displaying as a badge of Text column in Table (using ->badge()) will turn the whole text as a badge. How do we combine a Text column to show a text and a badge: 123 <low> where low is displayed as a badge while 123 as a normal text.
2 replies
FFilament
Created by Bagus A on 2/15/2024 in #❓┊help
How to fullWidth Action in Infolist
No description
4 replies
FFilament
Created by Bagus A on 12/29/2023 in #❓┊help
Show Image in InfoList
In infolist builder, we have an option to show image. My issue is that I don't save the image on the database. I will use an image uploaded to the public folder with filename of the code column. In normal blade, I'm going to render it with
<img height="65"
src="{{ public_path() . '/images/product_images/' . $orderItem->variant->product->code . '.png' }}"
class="" />
<img height="65"
src="{{ public_path() . '/images/product_images/' . $orderItem->variant->product->code . '.png' }}"
class="" />
How do I achieve this in InfoList card?
8 replies
FFilament
Created by Bagus A on 12/6/2023 in #❓┊help
Export Excel from an Action
No description
6 replies
FFilament
Created by Bagus A on 11/30/2023 in #❓┊help
Editable relations in ViewPage with InfoList
So, by default I got EditPage from a Resource allows me to edit it's RelationManager. Because I only need to show static data, I use InfoList and a ViewPage. But, inside this page, I still want to be able to edit the RelationManager (not the Resource owner data). How do I achieve this?
1 replies
FFilament
Created by Bagus A on 11/23/2023 in #❓┊help
How to Use Custom Modal Content
No description
3 replies
FFilament
Created by Bagus A on 11/18/2023 in #❓┊help
Where to rename create button in OrderResource page?
No description
8 replies
FFilament
Created by Bagus A on 11/11/2023 in #❓┊help
How to know what arguments available inside a function?
I'm sure it's not Filament only question, it might closely related to the PHP itself. For example, I would like to pre-process the data before saving it to the database. In this case I need to use before lifecycle hook for a CreateAction. I want to know how I can get the current form data inside this callback. Documentation example show the function without any arguments.
->before(function () {
// Runs before the form fields are saved to the database.
})
->before(function () {
// Runs before the form fields are saved to the database.
})
While, other example show it with two arguments

->before(function (CreateAction $action, Post $record) {}

->before(function (CreateAction $action, Post $record) {}
If I use my text editor to see inside before declaration inside HasLifeCycleHook.php it only has Closure.
public function before(Closure $callback): static
{
$this->before = $callback;

return $this;
}
public function before(Closure $callback): static
{
$this->before = $callback;

return $this;
}
I still don't understand how do I realize that any function in Filament can receive what kind of data? Appreciate every information. Thank you guys.
3 replies
FFilament
Created by Bagus A on 11/8/2023 in #❓┊help
Can I create two modal edit form with different fields?
If I have 4 fields in create form, A B C D. In the table, I would like to have 2 actions, "Edit Information A", "Edit Information B". The first action will only show a modal form with A B fields while the second action only show CD fields. How can I achieve this?
3 replies
FFilament
Created by Bagus A on 11/8/2023 in #❓┊help
Edit Page for RelationManager
I still want to use interactive tables underneath resource forms, but for edit mode, I would like to edit in a page not from a dialog. Is it possible?
2 replies
FFilament
Created by Bagus A on 11/7/2023 in #❓┊help
How to create infolist for RelationManager
No description
9 replies
FFilament
Created by Bagus A on 11/3/2023 in #❓┊help
TextColumn Dynamic Color
In table we can change column color with
TextColumn::make('status')
->color('primary')
TextColumn::make('status')
->color('primary')
How can we change the color dynamically, for example if status is shipped then, it's success, if status is cancelled then it's danger.
4 replies
FFilament
Created by Bagus A on 11/2/2023 in #❓┊help
Accessing Form State
No description
30 replies
FFilament
Created by Bagus A on 11/2/2023 in #❓┊help
Prevent save to not existing column
No description
10 replies
FFilament
Created by Bagus A on 11/1/2023 in #❓┊help
How to modify Chart widget width
In the docs we could change the chart height, but there's no info on how to change the width. I want to set it to something like columnSpanFull().
3 replies