Support the ongoing development of Laravel.io →
Requests Eloquent Views
Last updated 9 months ago.
0

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

Last updated 9 months ago.
0

You can register route like this:

Route::get('/dependencies/{id}/inventories',['as' => 'inventory.show','uses' => 
'[email protected]']);

and in your showInventories controller action:

public function showInventories($id)
{
	$dep = Dependence::find($id)
	$inventories = $dep->inventories;
	//return response etc

}
Last updated 9 months ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

cfgv cfgv Joined 26 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.