laravel eager loading closure
// with load
return $packageItem->load(['answers' => function ($query) use ($userId) {
$query->where('user_id', $userId);
}]);
// with with ;)
Entry::with(array(
'foo' => function($query) use ($id) {
$query->where('user_id', $id);
},
'author',
'lastModifiedBy'
))->...;
$x = $widget->objGallery->galleryItems()->with(array('captions' =>
function($query){ $query->where('locale', $id );
}))->get();