F
Filament2mo ago
kamav

Multiple Repeater

In the models Customer, Service, Transaction, ServiceTransaction, Payment, and PaymentTransaction, I display ServiceTransaction using a repeater in TransactionResource. I also want to use PaymentTransaction with a repeater, but it doesn't catch the payment_id. Is there a way to use a repeater that isn't related to the resource? Thank you!
Solution:
The problem is I can’t see the array sent by “payment” .
Yes, because you declared it a ->relationship() it is saving directly to that relationship and removing the data afterwards....
Jump to solution
5 Replies
Dennis Koch
Dennis Koch2mo ago
Repeaters aren't related to the resource. Somebody might help if you'd share some code. You are probably using the ->relationship() feature?
kamav
kamav2mo ago
->schema([
Section::make('Payment') ->schema([ Repeater::make('payments') ->relationship('paymentTransactions') ->schema([
TextInput::make('amount') ->numeric() ->label('Amount') ->required()->default(1), Select::make('currency') ->label('Currency') ->options([ 'USD' => 'USD', 'EUR' => 'EUR', 'GBP' => 'GBP', 'TRY' => 'TRY', 'JPY' => 'JPY', 'AUD' => 'AUD', ])
->required(),
]) ->addActionLabel('Add Payment') ->columns(3) ->defaultItems(1),
]), Select::make('status') ->options([ 'pending' => 'Pending', 'completed' => 'Completed', 'failed' => 'Failed', ]) ->default('pending') ->required(), ]); Actually when i use it in PaymentResource page it works, but in TransactionResource page it only works when i provide the payment-id manually. The problem is I can’t see the array sent by “payment” .
Dennis Koch
Dennis Koch2mo ago
Please read #✅┊rules on code formatting
Solution
Dennis Koch
Dennis Koch2mo ago
The problem is I can’t see the array sent by “payment” .
Yes, because you declared it a ->relationship() it is saving directly to that relationship and removing the data afterwards.
kamav
kamav2mo ago
Thank you so much, it worked after deleting the relationship.
Want results from more Discord servers?
Add your server