public function index() { $forums = Forum::where('parent_id', 0)->with('subForums')->orderBy('left_id')->get(); $forums = array_where($forums, function ($_i, $forum) { return $forum->canBeViewedBy(Auth::user()); }); return view('forum.forums.index', compact('forums')); }
public function index() { $forums = Forum::where("parent_id", 0)->with("subForums")->orderBy("left_id")->get(); $forums = array_where($forums, function ($_i, $forum) { return $forum->canBeViewedBy(Auth::user()); }); return view("forum.forums.index", compact("forums")); }
public function index() { $forums = Forum::where('parent_id', 0)->with('subForums')->orderBy('left_id')->get(); $forums = $forums->filter(function ($forum) { return priv_check('ForumView', $forum)->can(); }); return view('forum.forums.index', compact('forums')); }