本文整理汇总了PHP中App\Repositories\UserRepository::findByEmailOrCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::findByEmailOrCreate方法的具体用法?PHP UserRepository::findByEmailOrCreate怎么用?PHP UserRepository::findByEmailOrCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Repositories\UserRepository
的用法示例。
在下文中一共展示了UserRepository::findByEmailOrCreate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param boolean $hasCode
* @param AuthenticateUserListener $listener
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function execute($hasCode, AuthenticateUserListener $listener, $provider)
{
if (!$hasCode) {
return $this->getAuthorizationFirst($provider);
}
$user = $this->users->findByEmailOrCreate($this->getSocialUser($provider));
\Auth::login($user, true);
return $listener->userHasLoggedIn($user);
}
示例2: execute
public function execute($hasCode)
{
if (!$hasCode) {
return $this->getAuthFirst();
}
$user = $this->users->findByEmailOrCreate($this->getGithubUser());
Auth::loginUsingId($user->id, true);
return redirect('/profile');
}
示例3: execute
/**
* @param string $driver facebook/twitter/google+/github/etc
* @param bool $hasCode
* @param AuthenticateUserListener $listener
* @return mixed
*/
public function execute($driver, $hasCode, AuthenticateUserListener $listener)
{
if (!$hasCode) {
return $this->getAuthorizationFirst($driver);
}
$user = $this->users->findByEmailOrCreate($this->getUser($driver));
$this->auth->login($user, true);
return $listener->userHasLoggedIn($user);
}
示例4: execute
/**
* @param $hasCode
* @param $listener
* @param $social_provider
* @return mixed
*/
public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
{
if (!$hasCode) {
return $this->getAuthorizationFirst($social_provider);
}
$user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
if ($user == 'isDuplicate') {
Session::flash('message', "There some problems with your login! Credentials do not match. ");
Session::flash('alert-class', 'alert-danger');
return redirect()->back();
}
$this->auth->login($user, true);
return $listener->userHasLoggedIn($user);
}
示例5: execute
/**
* @param $hasCode
* @param $listener
* @param $social_provider
* @return mixed
*/
public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
{
// dd($hasCode);
if (!$hasCode) {
return $this->getAuthorizationFirst($social_provider);
}
$user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
if (!$user) {
Session::flash('message', "Something went wrong!");
Session::flash('alert-class', 'error');
}
$this->auth->login($user, true);
// event(new \App\Events\UserEvent($user->full_name));
return $listener->userHasBeenRegistered($user);
}
示例6: execute
/**
* @param $hasCode
* @param $listener
* @param $social_provider
* @return mixed
*/
public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
{
if (!$hasCode) {
return $this->getAuthorizationFirst($social_provider);
}
$user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider), $this->ip);
if (!$user) {
Session::flash('message', "Something went wrong!");
Session::flash('alert-class', 'error');
} else {
if ($user == 'user exist') {
return redirect()->route('home');
}
}
return $listener->userHasBeenRegistered($user);
}