Support the ongoing development of Laravel.io →
Requests Eloquent Views
Last updated 2 years 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 2 years ago.
0

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

}
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

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.

© 2024 Laravel.io - All rights reserved.