本文整理汇总了PHP中Illuminate\Support\Str::name方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::name方法的具体用法?PHP Str::name怎么用?PHP Str::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Str
的用法示例。
在下文中一共展示了Str::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleCallback
/**
* Handle the callback from GitHub.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function handleCallback()
{
$user = app(LoginProvider::class)->user();
$username = array_get($user, 'login');
$name = Str::name(array_get($user, 'name') ?: $username);
$this->dispatch(new LoginCommand((int) $user['id'], $name, $username, array_get($user, 'email'), array_get($user, 'token')));
if (count(app(RepoRepository::class)->allByUser(Auth::user())) > 0) {
return Redirect::route('home');
}
return Redirect::route('account');
}
示例2: handleCallback
/**
* Handle the callback from GitHub.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function handleCallback()
{
$user = app(LoginProvider::class)->user();
$username = array_get($user, 'login');
$name = Str::name(array_get($user, 'name') ?: $username);
$email = array_get($user, 'email');
$allowFor = config('auth.allow_for');
if (!in_array($email, $allowFor)) {
throw new CannotAccessEmailsException('Access denied for user with ' . $email . ' email.');
}
$this->dispatch(new LoginCommand((int) $user['id'], $name, $username, array_get($user, 'email'), array_get($user, 'token')));
if (count(app(RepoRepository::class)->allByUser(Auth::user())) > 0) {
return Redirect::route('home');
}
return Redirect::route('account');
}