PlaceHolder Form Component in Infolist Section
Hi all, is there any ways to apply same concept as placeholder form component in infolist ?
4 Replies
Why not TextEntry? Could you share what is the goal?
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
?
okay its worked! . Thanks for your help