Closed
Description
Currently, we can only use WHERE clauses in closures when eager loading. Like:
$users = User::with(array('posts' => function($query)
{
$query->where('title', 'like', '%first%');
}))->get();
Maybe allowing ORDERBY, LIMIT, OFFSET etc... will be a good idea? So we will have more control when eager loading something using Eloquent.
Something like:
$users = User::with(array('posts' => function($query)
{
$query->orderBy('created_at', 'desc');
}))->get();
Metadata
Metadata
Assignees
Labels
No labels