本文整理汇总了PHP中app\User::whereToken方法的典型用法代码示例。如果您正苦于以下问题:PHP User::whereToken方法的具体用法?PHP User::whereToken怎么用?PHP User::whereToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::whereToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirmEmail
public function confirmEmail($token)
{
User::whereToken($token)->firstOrFail()->confirmEmail();
alert()->success('Thanks you for comfirmation');
//session()->flash('message', 'Thanks you for comfirmation. ') ;
return redirect('login');
}
示例2: confirmEmail
/**
* Confirm a user's email
*
* @param $token
*/
public function confirmEmail($token)
{
$user = User::whereToken($token)->firstOrFail();
$user->verified = true;
$user->token = null;
$user->save();
}
示例3: getRegisterConfirm
/**
* Handle an email confirmation request for the application.
*
* @param $token
* @return \Illuminate\Http\RedirectResponse
*/
public function getRegisterConfirm($token)
{
$user = User::whereToken($token)->firstOrFail();
$user->verified = true;
$user->token = null;
$user->save();
return redirect()->route('account')->with('alert-success', 'Your e-mail address was successfully confirmed. You can now login to your account.');
}
示例4: confirmEmail
/**
* @param $token
* @return Redirect
*/
public function confirmEmail($token)
{
$role = Role::where('id', 3)->first();
$user = User::whereToken($token)->firstOrFail()->confirmEmail();
\DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
Auth::login($user);
// $user->assignRole($role);
return redirect()->to('dashboard');
}
示例5: confirm
public function confirm($token)
{
$user = User::whereToken($token)->first();
$user->verified = true;
$user->token = null;
$user->save();
session()->flash('message', 'You are Now Verified Please Login');
return redirect('login');
}
示例6: confirmEmail
/**
* Confirm a user's email address.
*
* @param string $token
* @return mixed
*/
public function confirmEmail(Request $request, $token)
{
// find user based on the verif token
$user = User::whereToken($token)->firstOrFail();
// confirm and login if not logged already
$user->confirmEmail();
if (Auth::guest()) {
Auth::login($user);
//TODO security implication of this
}
flash()->info(trans('messages.you_have_verified_your_email'));
return redirect('/');
}
示例7: confirmEmail
public function confirmEmail($token)
{
$user = User::whereToken($token)->first();
if ($user != null) {
$user->verified = true;
$user->token = null;
$user->save();
\Auth::loginUsingId($user->id);
session()->flash('message', 'Your email is now confirmed and your account activated. Please update your details');
return redirect('/myAccount');
}
return redirect('/register')->withErrors("Registration token not found");
}
示例8: index
public function index(Request $request)
{
$userToken = $request->get('user_token', '');
if (empty($userToken)) {
return response()->json(['status' => 'error', 'message' => 'user_token necesario']);
}
$user = User::whereToken($userToken)->first();
if (!is_null($user)) {
$orders = $user->orders()->whereStatus('success')->select('id', \DB::raw('CONCAT("PED", LPAD(id, 10, 0)) as number'), 'date_time')->orderBy('id', 'desc')->get();
return response()->json(['status' => 'success', 'message' => '', 'data' => $orders]);
} else {
return response()->json(['status' => 'error', 'message' => 'no se encontró usuario con el token especificado']);
}
}
示例9: verifyEmail
/**
* Verify user's email address.
*
* @param $token
* @return \Illuminate\Http\RedirectResponse
*/
public function verifyEmail($token)
{
$user = User::whereToken($token)->first();
if ($user) {
$user->confirmEmail();
flash()->overlay("Email verified", "You successfully verified your email address {$user->email}.", "success");
Auth::login($user, $remember = false);
} else {
flash()->overlay("Error", "This email address has been already confirmed.", "error");
}
return redirect('/');
}
示例10: confirmEmail
public function confirmEmail($token)
{
$user = User::whereToken($token)->firstOrFail()->confirmEmail();
flash('You are now confirmed. Please login.');
return redirect('login');
}
示例11: confirmEmail
public function confirmEmail($token)
{
try {
$user = User::whereToken($token)->firstOrFail();
$user->confirmEmail();
session()->flash('message', 'Thank you for confirming your email.');
$this->mailer->sendEmailHasBeenConfirmed($user);
} catch (ModelNotFoundException $e) {
session()->flash('message', 'This link has already been used or is invalid.');
}
return redirect('login');
}
示例12: confirmEmail
public function confirmEmail($token)
{
$user = User::whereToken($token)->firstOrFail();
$user->verified = true;
$user->token = null;
$user->save();
return view('prac.email_confirmation');
}
示例13: getByToken
public function getByToken()
{
return User::whereToken(session('user.token'))->first();
}
示例14: verifyEmail
/**
* Handle email confirmation
*
* @return void
*/
public function verifyEmail($token)
{
$user = User::whereToken($token)->firstOrFail()->verifyEmail();
\Notification::success(trans('registration.email_verification_successfull'));
return redirect()->route('login');
}
示例15: emailConfirm
public function emailConfirm($token)
{
try {
//primeros buscamos al negocio que tenga el usuario del token
//y asi le creamos la carpeta del negocio
//comentamos por el polymorphic
/*negocio = App\Negocio::whereHas('user', function ($query) use($token) {
$query->where('token', $token);
})->firstOrFail()->folderProfile();*/
$negocio = App\Negocio::whereHas('admin', function ($query) use($token) {
$query->join('users', 'admins.id', '=', 'users.user_id')->where('token', $token);
})->firstOrFail()->folderProfile();
//Ahora activamos al usuario
$user = User::whereToken($token)->firstOrFail()->confirmEmail();
return redirect('/login')->with('mensaje', '¡Su cuenta de usuario se ha activado, ahora puede iniciar sesión en su cuenta!');
} catch (ModelNotFoundException $e) {
return redirect('/login')->with('mensaje', 'Ya se ha confirmado a este usuario, solo inicie sesión ¬¬');
}
}