I think the correct syntax is
$model = Dependences::find(25)->has('inventories')->get();
foreach ($model as $row) $row->dependences->inventories
I may be off on the exact syntax
You can register route like this:
Route::get('/dependencies/{id}/inventories',['as' => 'inventory.show','uses' =>
'InventoryController@showInventories']);
and in your showInventories controller action:
public function showInventories($id)
{
$dep = Dependence::find($id)
$inventories = $dep->inventories;
//return response etc
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community