public function loadImage() { $userID = Auth::user()['id']; $path = UserProfile::find($userID)->profile_picture; $testpath = basename($path); if (Storage::exists("images/" . $userID . "/" . $testpath)) { return response()->download($path); } return response()->download(storage_path() . "/app/images/default/icon.png"); }
public function saveAboutMe(Request $request) { $userID = Auth::user()['id']; $userProfile = UserProfile::find($userID); if ($userProfile == null) { //create new row $userProfile = new UserProfile(); $userProfile->id = $userID; } //fill in fields $userProfile->about_me = Request::input('aboutme'); $userProfile->save(); return new RedirectResponse(url('/editprofile')); }
public function userProfile() { return UserProfile::find($this->getAttribute('profileid')); }
public function saveAboutMe(Request $request) { $this->validate($request, ['aboutme' => 'string|max:500']); $userID = Auth::user()['id']; $userProfile = UserProfile::find($userID); if ($userProfile == null) { //create new row $userProfile = new UserProfile(); $userProfile->id = $userID; } //fill in fields $userProfile->about_me = RequestF::input('aboutme'); $userProfile->save(); return new RedirectResponse(url('/profile')); }