I can't filter a collection with a variable:
$sections = Section::all();
$courses = array("MATH282", "MATH201" , "GEOM202");
foreach ($courses as $course)
{
$sections1 = $sections->filter(function($foo)
{
if ($foo->course == $course ) {
return true;
}
});
}
The filter works if the condition is a string. Everything else works.