public function beheerMateriaal() { if (Auth::check()) { $categories = Categorie::with('materials')->get(); return View::make('users.admin.beheerMateriaal', ['categories' => $categories]); } else { return Redirect::to('/'); } }
public function getCategoriesWhitMaterials() { return Categorie::with(array('materials' => function ($q) { $q->where('materials.status', '=', 'ok'); }))->get(); }