I'm having problem to try eager loading polymorphic relation in Laravel 4.1. Please take a look at this: http://help.laravel.io/d1fb6a5b00975db6 … f037b002f4
Basically i tested non-polymorphic eager loading, and it works perfectly.
And if I tried this, it works:
Route::get('polytest', function ()
{
$data = new \StdClass;
$data->model = new \Picture;
$posts = $data->model->find(1);
$posts = $posts->authorable;
//dd( DB::getQueryLog() );
return $posts;
});
But this doesnt work:
Route::get('polytest', function ()
{
$model = new \Picture;
$posts = $model->with('authorable')
->orderBy('updated_at', 'desc')
->take(15)
->get();
//dd( DB::getQueryLog() );
return $posts;
});
PS: the related models and migrations are in the link above.