Support the ongoing development of Laravel.io →
Eloquent Laravel Database
Last updated 2 years 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!

Eventy

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.

© 2024 Laravel.io - All rights reserved.