本文整理汇总了PHP中app\User::profile方法的典型用法代码示例。如果您正苦于以下问题:PHP User::profile方法的具体用法?PHP User::profile怎么用?PHP User::profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::profile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRegister
public function postRegister(Request $request)
{
//return \Redirect::back()->with('message','register function hijacked');
//temporarily for infosys users only.
$request['email'] = $request->input('email');
//.'@infosys.com';
$validator = $this->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
$activation_code = str_random(60);
$user = new \App\User();
$user->name = $request->input('name');
$user->email = $request->input('email');
$user->password = bcrypt($request->input('password'));
$user->activation_code = $activation_code;
if ($user->save()) {
/*create profile*/
$profile = new \App\Profile();
$profile->save();
$user->profile()->save($profile);
$data = array('name' => $user->name, 'code' => $activation_code);
\Mail::send('emails.activate', $data, function ($message) use($user) {
$message->to($user->email, $user->name)->subject('Please activate your account.');
});
\Auth::login($user);
flash('Please check your email for activating your account(check spam folder just in case or contact us if you did not receive email).');
return redirect()->route('rules');
} else {
flash('Your account couldn\\’t be created please try again');
return redirect()->back()->withInput();
}
}
示例2: postRegister
/**
* @param Request $request
* @return Redirect
*/
public function postRegister(Request $request)
{
$name = $request->input('name');
$email = $request->input('email');
$duplicate_name = User::where('name', $name)->first();
$duplicate_email = User::where('email', $email)->first();
if ($duplicate_name != null) {
return redirect('/auth/register')->withErrors('Name already used');
}
if ($duplicate_email != null) {
return redirect('/auth/register')->withErrors('Email already used');
}
$password = $request->input('password');
if ($name == '' || $email == '' || $password == '') {
return view('auth.register')->withName($name)->withEmail($email)->withErrors('Please fill all the fields');
}
$password_confirmation = $request->input('password_confirmation');
if ($password != $password_confirmation) {
return view('auth.register')->withName($name)->withEmail($email)->withErrors('The passwords must coincide');
}
$user = new User();
// var_dump($user);
// die();
$user->name = $name;
$user->email = $email;
$user->password = bcrypt($password);
$user->save();
$profile = new Profiles();
$user->profile()->save($profile);
Auth::login($user);
$cart = new Cart();
$cart->setOwnerId($user->id);
Session::put('cart', $cart);
return redirect('/')->withMessage('Registered successfully');
}
示例3: facebook
public function facebook()
{
$fb = new Facebook\Facebook(['app_id' => '144053429274589', 'app_secret' => '4ef6916e238aff3b6726dac08b853135', 'default_graph_version' => 'v2.4', 'default_access_token' => 'CAACDBA17B90BAKI0aOXR1vF5zDtZCOKPbWSXopnvvNpBTHZARXVhUVrZBAXn4CB1ZBgsyk13ZA38uZAWoffwchukfajiIOG7cYrNEEAm0CdlHgwDRWeBuD0OZCfT6PB6U2vsE3O45jTgx0YTc24TXEqyZC1ZBIjc9GxD3aSv6WAyIWsZCpAcbnxYPNCdL389FxaRsZD']);
try {
$response = $fb->get('/me?fields=id,name,email');
} catch (Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$me = $response->getGraphUser();
$name = $me['name'];
$email = $me['email'];
$u_name = preg_replace('/@.*$/', '', $me['email']);
$user = new User();
$user->name = $name;
$user->type = 'general';
$user->register_type = 'facebook';
$user->username = $u_name;
$user->email = $email;
$user->password = bcrypt($u_name);
$user->save();
$lastInsertedId = $user->id;
$profile = new Profile();
$profile = $user->profile()->save($profile);
$credentials = array('email' => $email, 'password' => $u_name);
if (Auth::attempt($credentials)) {
//return Redirect::to('home');
return redirect()->intended('home');
}
//echo '<pre>'; print_r($new_name);
//echo 'Logged in as ' . $me['email'];
}
示例4: update
/**
* Update the specified user in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\User $user
* @return \Illuminate\Http\Response
*/
public function update(Request $request, User $user)
{
$user->update($request->except('biography', 'contactDetails', 'address'));
$user->biography()->updateOrCreate([], $request->biography);
$user->contactDetails()->updateOrCreate([], $request->contactDetails);
$user->profile()->updateOrCreate([], $request->profile);
$user->address()->updateOrCreate([], $request->address);
\Notification::success("Künstler erfolgreich aktualisiert.");
return back();
}
示例5: register
public function register($data)
{
$user = new User();
$user->email = $data['email'];
$user->name = $data['email'];
$user->first_name = ucfirst($data['first_name']);
$user->last_name = ucfirst($data['last_name']);
$user->password = Hash::make($data['password']);
$user->save();
//Assign Role
$role = Role::whereName('user')->first();
$user->assignRole($role);
//Assign Profile
$profile = new Profile();
$user->profile()->save($profile);
}
示例6: postStore
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function postStore(Request $request)
{
$rules = array('name' => 'required', 'email' => 'required|email|unique:users', 'password' => 'required');
// 'password_confirm' => 'required|same:password'
//$input = $request->all();
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
/* return redirect()->back()->withErrors($validator); */
return redirect()->back()->withInput($request->only('email', 'name', 'last_name'))->withErrors($validator);
} else {
// create the data for our user
$user = new User();
$user->name = $request->input('name');
$user->last_name = $request->input('last_name');
$user->type = $request->input('type');
$user->username = $request->input('email');
$user->email = $request->input('email');
$user->password = bcrypt($request->input('password'));
$user->save();
$lastInsertedId = $user->id;
$profile = new Profile();
$profile->f_name = $request->input('name');
$profile->l_name = $request->input('last_name');
$profile = $user->profile()->save($profile);
/*
echo "First Name >> ".$request->get('name');
echo "<br>Las Name >> ".$request->get('last_name');
exit;
$profile = new Profile( ['f_name' => $request->get('name'), 'l_name' => $request->get('last_name') ] );
echo "<pre>";
print_r($profile);
exit;
*/
$profile = $user->profile()->save($profile);
$request->session()->flash('alert-success', 'User has been created successfully');
/* return redirect()->back()->withInput(); */
return redirect('admin/user');
exit;
}
}
示例7: postParams
public function postParams(StudentParamsRequest $r)
{
User::setParams($r->scolarite, $r->profil);
Session::flash('flash_message', 'Vos paramètres ont bien été enregistrés');
return view('etudiant.parametres')->with(['nb_results_not_read' => User::nbResultsNotRead(), 'first_name' => User::firstName(), 'last_name' => User::lastName(), 'parameters_defined' => User::parametersDefined(), 'user_profile' => User::profile(), 'profiles' => General::profils(), 'user_scolarite' => User::scolarite()]);
}