本文整理汇总了PHP中AuthUser::where方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthUser::where方法的具体用法?PHP AuthUser::where怎么用?PHP AuthUser::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthUser
的用法示例。
在下文中一共展示了AuthUser::where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postPublicLogin
/**
* Log an user
*
* @return Response
*/
public function postPublicLogin()
{
// Check if the form validates with success
if ($this->checkLogin()) {
// return var_dump($this->credentials);
// redirect the user back to the intended page
// or defaultpage if there isn't one
if (Auth::attempt($this->credentials, true)) {
//track user
parent::track('loggin', 'Auth', Auth::user()->id);
//return Redirect::intended('/');
if (Request::ajax()) {
return Response::json(array('statut' => 'success', 'message' => I18n::get('auth.login-success'), 'user_id' => User::getIdByAuth(Auth::user()->id)));
} else {
return Redirect::route('public.login')->with('success', I18n::get('auth.login-success'))->withInput(Input::except('password'));
}
} else {
$user = AuthUser::where('email', Input::get('email'))->first();
if (empty($user) || !isset($user)) {
if (Request::ajax()) {
return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.unknow_email')));
} else {
return Redirect::route('public.login')->with('error', I18n::get('auth.unknow_email'))->withInput(Input::except('password'));
}
}
if (Request::ajax()) {
return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.incorrect_password')));
} else {
return Redirect::route('public.login')->with('error', I18n::get('auth.incorrect_password'))->withInput(Input::except('password'));
}
}
$this->user = $user;
return Redirect::to('/');
}
if (Request::ajax()) {
return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.incorrect_password')));
} else {
return Redirect::route('public.login')->withInput()->withErrors($this->validator);
}
}