Hello I have Post model with relation:
public function category()
{
return $this->belongsTo(category::class);
}
I need show posts on every tab of category. For this I need use groupBy. When I do this:
$posts = Post::with('category')->groupBy('category.title')->get();
I get error:
Column not found: 1054 Unknown column 'category.title'.
Why? How I can return my posts with key of category title?
For multilangual I use this package: https://github.com/spatie/laravel-translatable