本文整理汇总了PHP中Illuminate\Auth\AuthManager::check方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthManager::check方法的具体用法?PHP AuthManager::check怎么用?PHP AuthManager::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Auth\AuthManager
的用法示例。
在下文中一共展示了AuthManager::check方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
public function filter(Route $route, Request $request)
{
if ($this->auth->check()) {
$config = $this->config->get('c::redirect-login');
$url = $config ? $this->url->to($config) : '/';
return $this->redirect->to($url);
}
}
示例2: allowedToEdit
/**
* Returns whether the logged in user is allowed to edit a page.
*
* @return bool
*/
public function allowedToEdit(Page $page = null)
{
if ($page === null) {
return true;
}
return Editor::isEnabled() && $this->auth->check('edit', $page);
}
示例3: handle
/**
* @param $request
* @param callable $next
* @return mixed
*/
public function handle($request, \Closure $next)
{
if ($this->auth->check()) {
$this->app->setLocale($this->auth->user()->getLocale());
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$asset = $request->route()->getParameter('asset');
if ($asset && !$this->auth->check()) {
$ip = ip2long($request->ip());
if (!AssetDownload::recentlyLogged($asset->getId(), $ip)->count() > 0) {
AssetDownload::create(['asset_id' => $asset->getId(), 'ip' => $ip, 'time' => time()]);
$asset->incrementDownloads();
}
}
return $next($request);
}
示例5: maySeeItem
/**
* Returns whether the given item should be visible to the user.
*
* @param array $item
* @return bool
*/
protected function maySeeItem(array $item)
{
if (!isset($item['logged_in'])) {
return true;
}
return $item['logged_in'] && $this->auth->check();
}
示例6: login
public function login()
{
if ($this->auth->check() && $this->auth->user()->can(['Dashboard'])) {
return $this->redirector->route("dashboard");
}
if ($this->auth->check() && !$this->auth->user()->can(['Dashboard'])) {
return $this->redirector->route("home");
}
$url = $this->request->get("url");
return $this->theme->baseDashboard("Admin::login")->with("url", $url);
}
示例7: logout
public function logout()
{
if (phpCAS::isSessionAuthenticated()) {
if ($this->auth->check()) {
$this->auth->logout();
}
Session::flush();
phpCAS::logout();
exit;
}
}
示例8: logout
/**
* This method is used to logout from CAS
*
* @param string $service a URL that will be transmitted to the CAS server to do a redirect after logout
*
* @return none
*/
public function logout($service = "")
{
if (phpCAS::isSessionAuthenticated()) {
if ($this->auth->check()) {
$this->auth->logout();
}
$this->session->flush();
if ($service != "") {
phpCAS::logoutWithRedirectService($service);
} else {
phpCAS::logout();
}
exit;
}
}
示例9: setUserByAuth
/**
* Set user by auth
*
* @return $this
*/
public function setUserByAuth()
{
if ($this->auth->check()) {
return $this->setUser($this->auth->user());
}
}
示例10: isLoggedIn
/**
* @return mixed
*/
public function isLoggedIn()
{
return $this->auth->check();
}