本文整理汇总了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');
}
示例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');
}
示例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');
}