当前位置: 首页>>代码示例>>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;未经允许,请勿转载。