コード例 #1
0
 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");
 }
コード例 #2
0
 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'));
 }
コード例 #3
0
ファイル: User.php プロジェクト: edragonetti/empa-Assign
 public function userProfile()
 {
     return UserProfile::find($this->getAttribute('profileid'));
 }
コード例 #4
0
ファイル: UserController.php プロジェクト: rterrazas328/IS421
 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'));
 }