elsonium
elsonium
FFilament
Created by elsonium on 8/28/2023 in #❓┊help
How to show error message in modal for custom Action::make()
Tables\Actions\Action::make('disburse-cash')
->label('Disburse Cash')
->icon('heroicon-o-cash')
->form([
DateTimePicker::make('date')
->label('Commission Disbursement For Date')
->withoutTime()
->required(),
])
->action(function (Merchant $record, array $data): void {
if ($data['date']) {

$transactions = $record->transactions()->whereDate('payout_time', Carbon::parse($data['date'])->toDateString())->get();

if (!$transactions->count()) {
// filament form error throw
throw new \Exception('No transactions found for the given date.');

return;
}
}
})
Tables\Actions\Action::make('disburse-cash')
->label('Disburse Cash')
->icon('heroicon-o-cash')
->form([
DateTimePicker::make('date')
->label('Commission Disbursement For Date')
->withoutTime()
->required(),
])
->action(function (Merchant $record, array $data): void {
if ($data['date']) {

$transactions = $record->transactions()->whereDate('payout_time', Carbon::parse($data['date'])->toDateString())->get();

if (!$transactions->count()) {
// filament form error throw
throw new \Exception('No transactions found for the given date.');

return;
}
}
})
Throw seems just show laravel error, but how do i show it on the Action modal itself?
9 replies
FFilament
Created by elsonium on 7/21/2023 in #❓┊help
Disable select option if selected in another repeater item
Assume i have a repeater with Select options, how can i disable the option if its selected in another repeater's select? Repeater::make('stocks') ->label('Merchant Stocks') ->schema([ Select::make('merchant_store_id') ->label('Merchant') ->reactive() ->options(function (Closure $get) { return \App\Models\Merchant::all()->pluck('name', 'id'); }) ->required(), TextInput::make('stock_count') ->label('Stock Count') ->required(), ]) ->disableItemMovement() how do i ensure the above Select only a Merchant is selected once in repeater.
4 replies
FFilament
Created by elsonium on 7/19/2023 in #❓┊help
Nested relationship managers
I have this relationship Products has many ProductVariants ProductVariants belongsToMany Merchants, where there will be a pivot column stock_count as each merchants maintains a different stock count for each product variants. I have created a VariantRelationshipManager for ProductResource however im not sure how i can add a nested relationship manager(merchants relationship) into VariantRelationshipManager. is there a way for nested relationship manager inside a relationship manager? or i'm looking at it wrongly.
8 replies