/** * @param string $slug * @param int $id * @param ProfileFieldGroupRepositoryInterface $profileFieldGroups * @param Breadcrumbs $breadcrumbs * * @return \Illuminate\View\View */ public function profile($slug, $id, ProfileFieldGroupRepositoryInterface $profileFieldGroups, Breadcrumbs $breadcrumbs) { $user = $this->users->find($id); if (!$user) { throw new UserNotFoundException(); } $groups = $profileFieldGroups->getAll(); $breadcrumbs->setCurrentRoute('user.profile', $user); return view('user.profile', ['user' => $user, 'profile_field_groups' => $groups]); }
/** * @return array */ protected function getAllProfileFields() { if (!$this->allProfileFields) { foreach ($this->profileFieldGroupRepository->getAll() as $profileFieldGroup) { foreach ($profileFieldGroup->getProfileFields()->get() as $profileField) { $this->allProfileFields[] = $profileField; } } } return $this->allProfileFields; }
/** * @param SaveProfileFieldGroupRequest $request * * @return \Illuminate\Http\RedirectResponse */ public function saveNewProfileFieldGroup(SaveProfileFieldGroupRequest $request) { $data = $request->only(['name', 'slug', 'description']); $this->profileFieldGroupRepository->create($data); return redirect()->route('admin.users.profile_fields')->withSuccess(trans('admin::general.success_saved')); }
/** * @param ProfileFieldGroupRepositoryInterface $profileFieldGroups * * @return mixed */ public function getProfile(ProfileFieldGroupRepositoryInterface $profileFieldGroups) { $dob = explode('-', $this->guard->user()->dob); $dob = ['day' => $dob[0], 'month' => $dob[1], 'year' => $dob[2]]; return view('account.profile', ['dob' => $dob, 'profile_field_groups' => $profileFieldGroups->getAll()])->withActive('profile'); }