当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::guest方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Redirect::guest方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::guest方法的具体用法?PHP Redirect::guest怎么用?PHP Redirect::guest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Redirect的用法示例。


在下文中一共展示了Redirect::guest方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->filter('auth', function () {
         if (Auth::guest()) {
             if (Request::ajax()) {
                 return Response::make('Unauthorized', 401);
             } else {
                 return Redirect::guest('/');
             }
         }
     });
     $router->filter('auth.basic', function () {
         return Auth::basic();
     });
     $router->filter('guest', function () {
         if (Auth::check()) {
             return Redirect::to('/');
         }
     });
     $router->filter('admin', function () {
         if (Auth::check()) {
             if (Auth::user()->email != "ceesco53@gmail.com") {
                 return Redirect::to('/');
             }
         } else {
             return Redirect::to('/');
         }
     });
     parent::boot($router);
 }
开发者ID:siparker,项目名称:ribbbon,代码行数:36,代码来源:RouteServiceProvider.php

示例2: edit

 public function edit()
 {
     $value = Cookie::get('uid');
     if ($value != '') {
         return Redirect::guest('page/1');
     } else {
         return Redirect::guest('/login');
     }
 }
开发者ID:simonwuwu,项目名称:lifespan,代码行数:9,代码来源:UserBehaviorController.php

示例3: store

 public function store(CreateAccountRequest $request)
 {
     //        $input = Request::all();
     $pharmacy = Pharmacy::create(["name" => $request->get('name'), "address" => $request->get('address'), "city" => $request->get('city'), "state" => $request->get('state'), "zipcode" => $request->get('zipcode'), "npi" => $request->get('npi'), "dea" => $request->get('dea'), "nabp" => $request->get('nabp'), "pic" => $request->get('pic'), "contact" => $request->get('contact'), "contact_person" => $request->get('contact_person'), "email" => $request->get('email'), "billing_address" => $request->get('billing_address'), "billing_city" => $request->get('billing_city'), "billing_state" => $request->get('billing_state'), "billing_zipcode" => $request->get('billing_zipcode'), "mailing_address" => $request->get('mailing_address'), "mailing_city" => $request->get('mailing_city'), "mailing_state" => $request->get('mailing_state'), "mailing_zipcode" => $request->get('mailing_zipcode')]);
     $pharmacists = new Pharmacist(["fname" => $request->get('name'), "mname" => $request->get('name'), "lname" => $request->get('name'), "bdate" => date('Y-m-d'), "email" => $request->get('email'), "contact" => $request->get('contact')]);
     $account = new Account(["username" => $request->get('username'), "password" => $request->get('password'), "rights" => "0"]);
     $pharmacy->pharmacists()->save($pharmacists)->account()->save($account);
     Session::flash('flash_message', 'Registration Successful!');
     return Redirect::guest('/');
 }
开发者ID:ramzdam,项目名称:knowmyc2,代码行数:10,代码来源:AccountsController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (config('typicms.auth_public') && !Auth::check()) {
         if ($request->ajax()) {
             return Response::make('Unauthorized', 401);
         }
         return Redirect::guest(route('login'));
     }
     return $next($request);
 }
开发者ID:webfactorybulgaria,项目名称:Core,代码行数:18,代码来源:PublicAccess.php

示例5: filter

 /**
  * Run the auth filter.
  *
  * We're verifying that the current user is logged in to Cachet.
  *
  * @param \Illuminate\Routing\Route $route
  * @param \Illuminate\Http\Request  $request
  *
  * @return \Illuminate\Http\Response|null
  */
 public function filter(Route $route, Request $request)
 {
     if (Auth::guest()) {
         if ($request->ajax()) {
             return Response::make('Unauthorized', 401);
         } else {
             return Redirect::guest('auth/login');
         }
     }
 }
开发者ID:baa-archieve,项目名称:Cachet,代码行数:20,代码来源:AuthFilter.php

示例6: handle

 public function handle($request, \Closure $next)
 {
     if (!$this->credentials->check()) {
         $this->logger->info('User tried to access a page without being logged in', ['path' => $request->path()]);
         if ($request->ajax()) {
             throw new UnauthorizedHttpException('Action Requires Login');
         }
         return Redirect::guest(URL::route('account.login'))->with('error', 'You must be logged in to perform that action.');
     }
     if (!$this->credentials->hasAccess($level = $this->level())) {
         $this->logger->warning('User tried to access a page without permission', ['path' => $request->path(), 'permission' => $level]);
         throw new AccessDeniedHttpException(ucfirst($level) . ' Permissions Are Required');
     }
 }
开发者ID:xhulioh25,项目名称:wiki,代码行数:14,代码来源:Auth.php

示例7: filters

 /**
  * Provide the needed filters.
  *
  * @return void
  */
 public function filters()
 {
     // authentication filter used by the system
     Route::filter('talkAuth', function () {
         if (Auth::guest() || get_class(Auth::user()) != Config::get('talk::auth.model')) {
             // redirect to login page
             return Redirect::guest(Config::get('talk::routes.base') . '/auth/login');
         }
     });
     // Make sure administrative accounts are admin only!
     Route::filter('talkAdmin', function () {
         if (Auth::guest() || Auth::user()->role != 10) {
             return 'Admin Only';
             // NO access to administration.
         }
     });
 }
开发者ID:micro,项目名称:talk,代码行数:22,代码来源:TalkServiceProvider.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (config('typicms.auth_public') && !Auth::check()) {
         if (Request::ajax()) {
             return Response::make('Unauthorized', 401);
         }
         return Redirect::guest(route('login'));
     }
     $response = $next($request);
     // HTML cache
     if ($response instanceof View && $request->method() == 'GET' && !Auth::check() && $this->queryStringIsEmptyOrOnlyPage($request) && !config('app.debug') && config('typicms.html_cache')) {
         $directory = public_path() . '/html' . $request->getPathInfo();
         if (!File::isDirectory($directory)) {
             File::makeDirectory($directory, 0777, true);
         }
         File::put($directory . '/index' . $request->getQueryString() . '.html', $response->render());
     }
     return $response;
 }
开发者ID:vizo,项目名称:Core,代码行数:26,代码来源:PublicAccess.php

示例9: filter

 /**
  * Main method, if 'successful' this method should not return anything (even true).
  *
  * @param $request
  * @return \Illuminate\Http\RedirectResponse
  * @throws Exception
  */
 public function filter($request)
 {
     // Check if user is authenticated via an auth session
     $this->session_authenticated = $this->isUserSessionAuthenticated();
     // Check if user is authenticated via an auth token
     $this->token_authenticated = $this->isUserTokenAuthenticated($request);
     // Decide if user is authenticated
     $this->user_authenticated = $this->isUserAuthenticated([$this->session_authenticated, $this->token_authenticated]);
     if ($this->user_authenticated === false) {
         // There is no way to know, for definite, which 'method' a user intended to authenticate, unless a token was
         // used, in which case it is safe to assume which method they were using.
         // In cases where a token wasn't given and the user has requested a JSON response, we assume they were trying
         // to use token authentication. Otherwise we assume they were trying to use session authentication.
         // Note: This approach maybe revised in the future.
         if ($this->token_authenticated !== false && $this->token_authenticated instanceof MissingTokenException === false || Request::wantsJson()) {
             $this->tokenAuthenticationFailure();
         }
         $this->sessionAuthenticationFailure();
         // BUG: For some reason issuing a redirect within a function other than this one doesn't do anything.
         return Redirect::guest('login');
     }
 }
开发者ID:antarctica,项目名称:laravel-token-auth,代码行数:29,代码来源:AuthFilter.php

示例10: filterRequests

 /**
  * Filter the incoming requests.
  */
 public function filterRequests($route, $request)
 {
     if (!is_object(Sentry::getUser()) || !Sentry::getUser()->hasAccess('admin')) {
         return Redirect::guest('admin/login');
     }
 }
开发者ID:nunodotferreira,项目名称:cms-1,代码行数:9,代码来源:AdminController.php

示例11: logout

 /**
  * @return bool
  */
 public function logout()
 {
     $this->admin->logout();
     return Redirect::guest('/');
 }
开发者ID:maxupunk,项目名称:metin2cms,代码行数:8,代码来源:AccountController.php


注:本文中的Illuminate\Support\Facades\Redirect::guest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。