mszabeh
Searchable relationship
Tables\Columns\TextColumn::make('user.first_name')
->label('user')
->searchable(['first_name','last_name'])
->formatStateUsing(fn (Domain $record): string => $record->user->first_name . ' ' . $record->user->last_name)
84 replies
Refresh Table
You can wit this:
https://filamentphp.com/docs/3.x/tables/advanced#polling-table-content
2 replies
Update TextInput maxValue
Forms\Components\Select::make('variation_id')
->options(Variation::query()->where('inventory', '>' , 0)->pluck('title', 'id'))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->id} {$record->title} {$record->id}")
->required()
->reactive()
->afterStateUpdated(function ($state, Forms\Set $set, Forms\Get $get) {
if($v = Variation::find($state)) {
// I need to set maxValue of quantity to $v->inventory;
}
})
->columnSpan([
'md' => 3,
])
->searchable(),
Forms\Components\TextInput::make('quantity')
->label('Quantity')
->numeric(),
8 replies
How to generate new assets
The instructions:
WARN Action is required to complete the theme setup:
⇂ First, add a new item to the
input array of
vite.config.js:
resources/css/filament/admin/theme.css
⇂ Next, register the theme in the admin panel provider using
->viteTheme('resources/css/filament/admin/theme.css')
⇂ Finally, run
npm run build to compile the theme
4 replies
Get record in edit widget
https://filamentphp.com/docs/3.x/panels/resources/widgets#accessing-the-current-record-in-the-widget
7 replies
How to use Tabs getActiveTab() in form
I have one field address_id for chose one address from user addresses in tab #1
and i have card for insert new address fields in tab #2
i need to set requred() to addres_id field in tab #1 if tab 1 activated
and set required() to all fileds in tab 2 , if tab 2 activated.
14 replies