/** * @param AccountManager $accountManager * @param Team $team * @return \Illuminate\Contracts\View\View */ public function index(AccountManager $accountManager, Team $team) { $account = $accountManager->account(); $memberships = $account->memberships; //make sure to test all templates when changing these relations. //some templates show data by running through teams and others by running through memberships $memberships->load(['member', 'member.images', 'member.socialLinks', 'member.skills', 'member.skills.translations']); $teams = $team->with(['memberships', 'translations'])->whereHas('memberships', function ($query) { $query->whereNotNull('id'); }, '>=')->get(); return $this->theme->render('team.index', ['memberships' => $memberships, 'teams' => $teams]); }
/** * @param Team $team * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function index(Team $team) { return $team->with(['translations'])->get(); }