Support the ongoing development of Laravel.io →
Eloquent Laravel Database
Last updated 10 months ago.
0

So I got an answer over on Laracasts and I'd thought I'd post it here in case anybody is searching.

$store = Store::with('shirts', 'jackets')->find($id);

$sortedInventory =  $store
	->shirts
	->merge($store->jackets)
	->sortBy(['pivot.inventory_date'], 'ASC');
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Willis willis1776 Joined 26 May 2021

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.