當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。