I'm having a model with a morphMany relation which works well in my controllers.
public function profileImages()
{
return $this->morphMany('App\Image', 'imaginable');
}
In the grid i'd like to show a badge with a counter $grid->profileImages()->count()->badge(); but the column stays empty. I've also tried to loop over the images via ->display(function ($images) {}) but i'm always getting null as the result.
I couldn't find any code regarding grid and morpMany relationships https://github.com/z-song/laravel-admin/search?utf8=%E2%9C%93&q=morphMany&type= are i'm missing something or is this unsupported at the moment?
Thanks in advance!
could be related to #946
Try
$grid->model()->with('profileImages');
$grid->column('profile_images')->count()->badge();
@z-song yes that works! Thanks
Most helpful comment
Try