public static function viewBindings() { \View::creator('dashboard.guardian-children', function (View $view) { $season = Session::season(); $groupToRegisterWith = Session::getGroupToRegisterWith(); $view->with('children', Auth::user()->players()->with(['seasons' => function ($q) use($season) { $q->where('seasons.id', $season->id); }, 'groups' => function ($q) use($season) { $q->wherePivot('season_id', $season->id); }])->get())->with('season', $season)->with('hasGroupToRegisterWith', $groupToRegisterWith != null)->with('groupToRegisterWith', $groupToRegisterWith); }); \View::creator('dashboard.season-overview', function (View $view) { $season = Session::season(); /** @var MetricsRepository $metrics */ $metrics = app(MetricsRepository::class); $playerCount = $metrics->playerCount($season); $view->with(['groupCount' => $metrics->groupCount($season), 'playerCount' => $playerCount, 'averageGroupSize' => $metrics->averageGroupSize($playerCount)]); }); \View::creator('dashboard.tournaments', function (View $view) { $season = Session::season(); $view->with('tournaments', Tournament::visible(Session::group()->program_id, $season)->get()); }); }