本文整理匯總了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');
}