PlaceHolder Form Component in Infolist Section

Hi all, is there any ways to apply same concept as placeholder form component in infolist ?
Solution:
TextEntry::make('payments_count')
->state(fn (YourModel $record) => $record->totalAmount())
TextEntry::make('payments_count')
->state(fn (YourModel $record) => $record->totalAmount())
?...
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira7mo ago
Why not TextEntry? Could you share what is the goal?
Expecto Patronum
Expecto PatronumOP7mo ago
because i want to achieve to count attribute from relation manager in owner resource . i already try implement with placeholder . its working but i want to use infolist . so searching other way in infolist same as placeholder . Below is my code . in my owner resource form : Forms\Components\Placeholder::make('payments_count') ->label('Jumlah Keseluruhan Bayaran') ->content(function (PaymentLog $record) { return new HtmlString(" <table style='width: 100%;'> <tr> <td><strong>Jumlah:</strong></td> <td> RM " . number_format($record->totalAmount(), 2) . "</td> </tr> </table> "); }) in my model : public function paymentLogItem() { return $this->hasMany(PaymentLogItem::class); } public function totalAmount(): int { return $this->paymentLogItem->sum('amount'); } in my relation manager form : textinput::make('amount')
Solution
LeandroFerreira
LeandroFerreira7mo ago
TextEntry::make('payments_count')
->state(fn (YourModel $record) => $record->totalAmount())
TextEntry::make('payments_count')
->state(fn (YourModel $record) => $record->totalAmount())
?
Expecto Patronum
Expecto PatronumOP7mo ago
okay its worked! . Thanks for your help
Want results from more Discord servers?
Add your server