I am trying to understand how to filter my eager loaded results. In my show method on my category controller I have
public function show(Category $category)
{
$category->load('events');
return view('category.show', compact('category'));
}
This returns my current category with the eager loaded events so my relationships are working. My question is how do I filter those returned events.
I guess I should use a where() method but when I use
How do I filter the eager loading results?
Hi All,
I am trying to understand how to filter my eager loaded results. In my show method on my category controller I have
This returns my current category with the eager loaded events so my relationships are working. My question is how do I filter those returned events. I guess I should use a where() method but when I use
It is searching my categories class for the approved column, not my events class. Is there a way to tell Laravel to search the eager loaded class?
Thanks!