當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sentry::Check方法代碼示例

本文整理匯總了PHP中Sentry::Check方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sentry::Check方法的具體用法?PHP Sentry::Check怎麽用?PHP Sentry::Check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sentry的用法示例。


在下文中一共展示了Sentry::Check方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //$chapter = Chapter::find($id);
     $chapter = Chapter::where('id', '=', $id)->orWhere('slug', '=', $id)->first();
     $book = Book::where('id', '=', $chapter->book_id)->first();
     if ($chapter) {
         if (!$book && $chapter->public_state == true) {
             $markdownParser = new MarkdownParser();
             $markdownText = $markdownParser->transformMarkdown($chapter->text);
             return View::make('chapter.single', array('chapter' => $chapter, 'chapter_text' => $markdownText, 'pageTitle' => 'Chapter: ' . $chapter->title));
         } elseif ($chapter->public_state == true && $book && $book->public_state == true) {
             $markdownParser = new MarkdownParser();
             $markdownText = $markdownParser->transformMarkdown($chapter->text);
             return View::make('chapter.single', array('chapter' => $chapter, 'chapter_text' => $markdownText, 'pageTitle' => 'Chapter: ' . $chapter->title));
         } elseif (Sentry::Check() && $chapter->author_id == Sentry::getUser()->id) {
             $markdownParser = new MarkdownParser();
             $markdownText = $markdownParser->transformMarkdown($chapter->text);
             return View::make('chapter.single', array('chapter' => $chapter, 'chapter_text' => $markdownText, 'pageTitle' => 'Chapter: ' . $chapter->title));
         } else {
             return Redirect::to('/')->with('global_error', 'You can\'t access private resources without a secret link, which can be received from creation\'s author.');
         }
     }
     return Redirect::to('/')->with('global_error', 'Sorry, chapter you are trying to reach doesn\'t exist.');
 }
開發者ID:Belar,項目名稱:librific,代碼行數:30,代碼來源:ChapterController.php

示例2: function

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    if (!Sentry::Check()) {
        return View::make("login.index");
    } else {
        return Redirect::route("front_report_livestock_index_get");
    }
});
/* ---*/
Route::get('login', array("as" => "login_get", function () {
    if (!Sentry::check()) {
        return View::make('login.index');
    } else {
        return Redirect::route('front_report_livestock_index_get');
    }
}));
/*Route xu ly duogn dan kg tim thay */
Route::get("error.html", array("as" => "error_page", function () {
    return View::make('errors.somethingwentwrong');
}));
開發者ID:hoangec,項目名稱:HaglPortal,代碼行數:31,代碼來源:routes+-+Copy.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $book = Book::where('id', '=', $id)->orWhere('slug', '=', $id)->first();
     $chapters = Chapter::where('book_id', '=', $book->id)->where('public_state', '=', true)->paginate(15);
     if ($book) {
         if ($book->public_state == true) {
             return View::make('book.single', array('book' => $book, 'chapters' => $chapters, 'pageTitle' => 'Book: ' . $book->title));
         } elseif (Sentry::Check() && $book->author_id == Sentry::getUser()->id) {
             return View::make('book.single', array('book' => $book, 'chapters' => $chapters, 'pageTitle' => 'Book: ' . $book->title));
         } else {
             return Redirect::to('/')->with('global_error', 'You can\'t access private resources without a secret link, which can be received from creation\'s author.');
         }
     }
     return Redirect::to('/')->with('global_error', 'Sorry, book you are trying to reach doesn\'t exist.');
 }
開發者ID:Belar,項目名稱:librific,代碼行數:21,代碼來源:BookController.php


注:本文中的Sentry::Check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。