kawtar
repeatable entry
I have 3 tables:
Order(id, num,...) Orderline(id, order_id, status,...) Orderdetails(id, orderline_id,produit_name, produit_photo,...)
Relations orderline has one Order Orderdetails can have multiple orderline
in Order model:
public function orderline() {
return $this->hasMany(Orderline::class, 'order_id');
}
in Orderline model:
public function orderdetails() {
return $this->hasMany(OrderDetails::class, 'orderline_id');
}
in orderdetails model:
public function orderline() {
return $this->belongsTo(Orderline::class, 'orderline_id');
}
in my controller:
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
RepeatableEntry::make('Liste des produits')
->schema([
// Loop through the orderlines and their corresponding orderdetails
TextEntry::make('orderlines..orderdetails..dish_name')
->label('Nom du produit'),
TextEntry::make('orderlines..orderdetails..dish_photo')
->label('Photo'),
TextEntry::make('orderlines..orderdetails..dish_details')
->label('Détails du produit'),
])
]);
}
This repeatable doesn't show any results. I want to display the orderDetails fields. What's the problem, and what should I do to resolve it?
2 replies