mango1026
mango1026
FFilament
Created by mango1026 on 8/2/2023 in #❓┊help
How to get current route and params inside updateStateUsing?
11 replies
FFilament
Created by mango1026 on 8/1/2023 in #❓┊help
Possible to use TextInputColumn to update a relationship that has pivot table?
TextInputColumn::make('stock_count')
->label('Stock Count')
->visible(request()->has('merchant_id'))
->default(function ($record) {
// at the moment we get the first variant
$variant_id = $record->variants()->first()->id;
// lazy load 2 levels.
$stocks = $record->variants()->where('id', $variant_id)->first()
->merchants()->where('merchant_store_id', request()->get('merchant_id'))->first();

return $stocks ? $stocks->pivot->stock_count : 0;

})->label('Stock Count')
TextInputColumn::make('stock_count')
->label('Stock Count')
->visible(request()->has('merchant_id'))
->default(function ($record) {
// at the moment we get the first variant
$variant_id = $record->variants()->first()->id;
// lazy load 2 levels.
$stocks = $record->variants()->where('id', $variant_id)->first()
->merchants()->where('merchant_store_id', request()->get('merchant_id'))->first();

return $stocks ? $stocks->pivot->stock_count : 0;

})->label('Stock Count')
9 replies