Jason Gilmore has a new tutorial showing a way of ordering belongsToMany relationships by the pivot table.
Filed in: Laravel Tutorials / Eloquent
When declaring a belongsToMany relation in Laravel, you can optionally include the withTimestamps method to indicate the pivot table’s created_at and updated_at columns should be updated whenever a new pivot table record is inserted or updated. But how can you order your query results using one of these columns? In this tutorial, I’ll show you how.
- Senior Full-Time Laravel Developer (REMOTE)
- Senior Laravel Developer
Remote, USA & Canada Only
- Backend Software Engineer
Remote, USA Only
- Full Stack Laravel Developer (Full-time/Contract)
Remote or Columbus, OH
- Backend PHP Developer
ABOUT YOU GmbH
Join 31,000+ others and never miss out on new tips, tutorials, and more.
Larvel™ A new enterprise framework
PHP is one of the most widely used web development languages, but it has long been considered the worst to work with.…
Laravel Podcast 24 – Dog At The Keyboard
Listen to the latest Laravel Podcast episode where the crew discusses PHP 7, Browserify, and their favorite Mac Apps.…