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


PHP Sentry::check方法代码示例

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


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

示例1: reset

 public function reset($id)
 {
     if (Sentry::check()) {
         return Redirect::route('admin.dashboard');
     }
     return View::make('administrator.reset', ['title' => 'Nueva Contraseña', 'data' => $id]);
 }
开发者ID:eldalo,项目名称:jarvix,代码行数:7,代码来源:AdminController.php

示例2: postView

 /**
  * View a blog post.
  *
  * @param  string  $slug
  * @return Redirect
  */
 public function postView($slug)
 {
     // The user needs to be logged in, make that check please
     if (!Sentry::check()) {
         return Redirect::to("blog/{$slug}#comments")->with('error', 'You need to be logged in to post comments!');
     }
     // Get this blog post data
     $post = Post::where('slug', $slug)->first();
     // Declare the rules for the form validation
     $rules = array('comment' => 'required|min:3');
     // Create a new validator instance from our dynamic rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now
     if ($validator->fails()) {
         // Redirect to this blog post page
         return Redirect::to("blog/{$slug}#comments")->withInput()->withErrors($validator);
     }
     // Save the comment
     $comment = new Comment();
     $comment->user_id = Sentry::getUser()->id;
     $comment->content = e(Input::get('comment'));
     // Was the comment saved with success?
     if ($post->comments()->save($comment)) {
         // Redirect to this blog post page
         return Redirect::to("blog/{$slug}#comments")->with('success', 'Your comment was successfully added.');
     }
     // Redirect to this blog post page
     return Redirect::to("blog/{$slug}#comments")->with('error', 'There was a problem adding your comment, please try again.');
 }
开发者ID:forestallers,项目名称:laravel-starter-kit,代码行数:35,代码来源:BlogController.php

示例3: before

 public function before()
 {
     $this->nocversion = 'none';
     $path = $this->request->route->path;
     if ($path != 'auth/login') {
         $this->check_license($path);
     }
     parent::before();
     //$auth = Auth::instance();
     //Auth::instance()->login('hrvoje','hajduk81');
     /*
     if(!$this->check_license())
     \Response::redirect(\Config::get('base_url').'/ajax/license');
     */
     $uri_string = explode('/', Uri::string());
     if (count($uri_string) > 1 and $uri_string[0] == 'auth' and $uri_string[1] == 'login') {
         return;
     }
     if ($path != '_root_') {
         if (\Sentry::check()) {
             $this->user = Sentry::user()->get('id');
             $this->username = Sentry::user()->get('username');
             return;
         } else {
             $this->user = false;
             $this->username = '';
             \Response::redirect(\Config::get('base_url') . 'auth/login');
         }
     }
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:30,代码来源:login.php

示例4: postView

 /**
  * View a blog post.
  *
  * @param  string  $slug
  * @return Redirect
  */
 public function postView($slug)
 {
     // The user needs to be logged in, make that check please.
     if (!Sentry::check()) {
         return Redirect::to($slug . '#comments')->with('error', 'You need to be logged in to post comments!');
     }
     // Get this blog post data
     $post = Post::where('slug', '=', $slug)->first();
     // Declare the rules for the form validation
     $rules = array('comment' => 'required|min:3');
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         // Save the comment
         $comment = new Comment();
         $comment->user_id = Sentry::getUser()->id;
         $comment->content = Input::get('comment');
         // Was the comment saved with success?
         if ($post->comments()->save($comment)) {
             // Redirect to this blog post page
             return Redirect::to($slug . '#comments')->with('success', 'Your comment was added with success.');
         }
         // Redirect to this blog post page
         return Redirect::to($slug . '#comments')->with('error', 'There was a problem adding your comment, please try again.');
     }
     // Redirect to this blog post page
     return Redirect::to($slug)->withInput()->withErrors($validator);
 }
开发者ID:nozkok,项目名称:laravel-4-starter,代码行数:35,代码来源:BlogController.php

示例5: postView

 /**
  * View a blog post.
  *
  * @param  string   $slug
  * @return Redirect
  */
 public function postView($slug)
 {
     // The user needs to be logged in, make that check please
     if (!Sentry::check()) {
         return Redirect::to("blog/{$slug}#comments")->with('error', Lang::get('post.messages.login'));
     }
     // Get this blog post data
     $post = $this->post->where('slug', $slug)->first();
     // get the  data
     $new = Input::all();
     $comment = new Comment();
     // If validation fails, we'll exit the operation now
     if ($comment->validate($new)) {
         // Save the comment
         $comment->user_id = Sentry::getUser()->id;
         $comment->content = e(Input::get('comment'));
         // Was the comment saved with success?
         if ($post->comments()->save($comment)) {
             // Redirect to this blog post page
             return Redirect::to("blog/{$slug}#comments")->with('success', 'Your comment was successfully added.');
         }
     } else {
         // failure, get errors
         return Redirect::to("blog/{$slug}#comments")->withInput()->withErrors($comment->errors());
     }
     // Redirect to this blog post page
     return Redirect::to("blog/{$slug}#comments")->with('error', Lang::get('post.messages.generic'));
 }
开发者ID:jeremiteki,项目名称:mteja-laravel,代码行数:34,代码来源:PostController.php

示例6: showLogin

 public function showLogin()
 {
     if (Sentry::check()) {
         return Redirect::to('/admin');
     }
     return View::make('admin::vis-login');
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject2,代码行数:7,代码来源:BackendAdminController.php

示例7: check

 public function check()
 {
     if (!Sentry::check()) {
         $this->layout = null;
         return Redirect::action('HomeController@index')->with('message', "<div class='alert alert-danger'>You don't have access to this page.</div>");
     }
 }
开发者ID:g0ddish,项目名称:ResearchMonster,代码行数:7,代码来源:BaseAuthController.php

示例8: getDefault

 /**
  * Handles GET requests from /
  *
  * @return view
  */
 public function getDefault()
 {
     if (Sentry::check()) {
         return Redirect::to('dashboard');
     }
     return View::make('layouts.default');
 }
开发者ID:shampine,项目名称:plumage,代码行数:12,代码来源:AuthController.php

示例9: isCurrent

 public function isCurrent()
 {
     if (!Sentry::check()) {
         return false;
     }
     return Sentry::getUser()->id == $this->id;
 }
开发者ID:ArbindJain,项目名称:basic-auth-sentry,代码行数:7,代码来源:User.php

示例10: showLogin

 public function showLogin()
 {
     if (\Sentry::check()) {
         return \Redirect::to(\Config::get('jarboe::admin.uri'));
     }
     return \View::make('admin::vis-login');
 }
开发者ID:OlesKashchenko,项目名称:Jarboe,代码行数:7,代码来源:TBController.php

示例11: getLogin

 /**
  * Display the login page
  * @return View
  */
 public function getLogin()
 {
     if (Sentry::check()) {
         return Redirect::route('admin.index');
     }
     return View::make('admin.auth.login');
 }
开发者ID:kettanyam,项目名称:20141001done,代码行数:11,代码来源:AuthController.php

示例12: __construct

 public function __construct()
 {
     if (Sentry::check()) {
         // User is not logged in, or is not activated
         $this->data['admin'] = Sentry::getUser();
     }
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:7,代码来源:BaseController.php

示例13: getLogout

 public function getLogout()
 {
     if (Sentry::check()) {
         Sentry::logout();
         return Redirect::route('index');
     }
 }
开发者ID:minnb,项目名称:vitduct,代码行数:7,代码来源:AuthController.php

示例14: execute

 public function execute($function)
 {
     if (Sentry::check() && Sentry::getUser()->isSuperUser()) {
         return $function();
     }
     return 'You have no privileges to access this page!';
 }
开发者ID:shaikhatik0786,项目名称:Masteranime,代码行数:7,代码来源:AnimeManageController.php

示例15: pushMessage

 public function pushMessage()
 {
     if (!Sentry::check()) {
         return Response::json(array('errCode' => 10, 'message' => '请登录'));
     }
     Sentry::login(Sentry::findUserById(5), false);
     $user = Sentry::getUser();
     // $user = User::find(1);
     $push_status = PushStatus::where('user_id', $user->id)->first();
     if (count($push_status) == 0) {
         $push_status = new PushStatus();
         $push_status->user_id = $user->id;
         $push_status->status = 1;
         if (!$push_status->save()) {
             return Response::json(array('errCode' => 1, 'message' => '[数据库错误]开启消息推送失败'));
         }
         return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
     }
     if ($push_status->status == 1) {
         $push_status->status = 0;
         if (!$push_status->save()) {
             return Response::json(array('errCode' => 2, 'message' => '[数据库错误]开启消息推送失败'));
         }
         return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
     }
     if ($push_status->status == 0) {
         $push_status->status = 1;
         if (!$push_status->save()) {
             return Response::json(array('errCode' => 3, 'message' => '[数据库错误]开启消息推送失败'));
         }
         return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
     }
 }
开发者ID:Jv-Juven,项目名称:gift,代码行数:33,代码来源:SiteController.php


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