當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserProfile::firstOrNew方法代碼示例

本文整理匯總了PHP中UserProfile::firstOrNew方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserProfile::firstOrNew方法的具體用法?PHP UserProfile::firstOrNew怎麽用?PHP UserProfile::firstOrNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserProfile的用法示例。


在下文中一共展示了UserProfile::firstOrNew方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: saveProfile

 public function saveProfile()
 {
     $id = Auth::user()->id;
     $profile = UserProfile::firstOrNew(array('id' => $id));
     $profile->fname = Input::get('fname');
     $profile->lname = Input::get('lname');
     $profile->streetno = Input::get('streetno');
     $profile->street = Input::get('street');
     $profile->suburb = Input::get('suburb');
     $profile->postcode = Input::get('postcode');
     $profile->state = Input::get('state');
     $profile->dob = Input::get('dob');
     $profile->phone = Input::get('phone');
     $profile->tfn = Input::get('tfn');
     $profile->pidtype = Input::get('pidtype');
     $profile->pidnum = Input::get('pidnum');
     $profile->sidtype = Input::get('sidtype');
     $profile->sidnum = Input::get('sidnum');
     $profile->description = Input::get('description');
     $profile->gender = Input::get('gender');
     $profile->occupation = Input::get('occupation');
     $profile->save();
     return Redirect::to('profile');
 }
開發者ID:Hongzhe,項目名稱:DECO3801-PeerTech,代碼行數:24,代碼來源:UserProfileController.php

示例2: verify_email

 public function verify_email($code)
 {
     try {
         $user = User::where('activation_code', '=', $code)->first();
         if ($user == null) {
             echo "Invalide verfication code";
             return;
         } elseif ($user->activated == 1) {
             echo "You have already been verified";
             return;
         }
         $user->activated = 1;
         $user->save();
         $id = $user->id;
         Auth::login($user);
         //verify success and login user
         //create a profile record for this new user
         $profile = UserProfile::firstOrNew(array('id' => $id));
         $financial = FinancialProfile::firstOrNew(array('user_id' => $id));
         $profile->save();
         $financial->save();
         /*DB::table('users')
         			-> where('activation_code',$code)
         			-> update(array('activated'=>1));
         		}catch(Exception $e) {
         			echo $e -> getMessage();
         		}*/
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return Redirect::route('myprofile');
 }
開發者ID:Hongzhe,項目名稱:DECO3801-PeerTech,代碼行數:32,代碼來源:HomeController.php

示例3: saveNewProfile

 public function saveNewProfile()
 {
     $id = Auth::user()->id;
     $profile = UserProfile::firstOrNew(array('id' => $id));
     $profile->fname = Input::get('fname');
     $profile->lname = Input::get('lname');
     $profile->streetno = Input::get('streetno');
     $profile->street = Input::get('street');
     $profile->suburb = Input::get('suburb');
     $profile->postcode = Input::get('postcode');
     $profile->state = Input::get('state');
     $profile->day_dob = Input::get('day_dob');
     $profile->month_dob = Input::get('month_dob');
     $profile->year_dob = Input::get('year_dob');
     $profile->phone = Input::get('phone');
     $profile->tfn = Input::get('tfn');
     $profile->pidtype = Input::get('pidtype');
     $profile->pidnum = Input::get('pidnum');
     $profile->sidtype = Input::get('sidtype');
     $profile->sidnum = Input::get('sidnum');
     $profile->description = Input::get('description');
     $profile->gender = Input::get('gender');
     $profile->occupation = Input::get('occupation');
     $profile->currency = 'AUD';
     $profile->save();
     $user = User::where('id', '=', $id)->first();
     $user->profile_complete = 1;
     $user->save();
     return Redirect::Route('profile');
 }
開發者ID:Clare-E-Rich,項目名稱:DECO7381_MoneyLink_GroupProject,代碼行數:30,代碼來源:UserProfileController.php


注:本文中的UserProfile::firstOrNew方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。