当前位置: 首页>>代码示例>>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;未经允许,请勿转载。