The Price - Store relationship must be configured.
$tbody = ''; foreach(Price::with('store')->where('product_id', $id)->get() as $price) { // with() подгружает связанные сущности Store $tbody .= ' <tr> <td><a href="/store/' . $price->store->id . '">' .$price->store->title . '</a> </td> <td>' . $price->store->address . '</td> <td>' . $price->price . '</td> <td>' . $price->updated_at . '</td> </tr> '; }
The result will be in $tbody
.
If you do everything in a good way, then you need to transfer from the controller
$prices = Price::with('store')->where('product_id', $id)->get()
and then in the template
@foreach($prices as $price) <tr><a href="/store/{!! $price->store->id !!}">{!! $price->store->title !!}</a> </td> <td>{!! $price->store->address !!}</td> <td>{!! $price->price !!}</td> <td>{!! $price->updated_at !!}</td> </tr> @endforeach
And of course the link is better to replace with route or action.