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


PHP Comment::orderBy方法代码示例

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


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

示例1: getIndex

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Session::get('user_level') < Config::get('cms.viewComments')) {
         return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
     }
     $this->setLayout();
     if (Input::get('q')) {
         $comments = Comment::where('comment_content', 'LIKE', '%' . Input::get('q') . '%')->orderBy('created_at', 'desc')->paginate(20);
     } else {
         $comments = Comment::orderBy('created_at', 'desc')->paginate(20);
     }
     View::share('title', __(Lang::get('admin.comments')));
     View::share('comments', $comments);
     $this->layout->content = View::make('backend.comments.index');
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:20,代码来源:CommentController.php

示例2: listComment

 public function listComment()
 {
     $comments = Comment::orderBy('id', 'desc')->paginate(20);
     $this->layout->title = 'Liste des commentaires';
     $this->layout->main = View::make('dash')->nest('content', 'comments.list', compact('comments'));
     /* BUG LORSQUE CE CODE EST ACTIVE (Trying to get property of non-object (View: /Users/jeremymarchandeau/Sites/projet-cms/app/views/comments/list.blade.php) ) */
     /*$sortby = Input::get('sortby'); 
     	    $order = Input::get('order');
     	 
     	    if ($sortby && $order) {
     	        $comments = Comment::orderBy($sortby, $order)->get();
     	    } else {
     	        $comments = Comment::orderBy('commenter', 'DESC')->get();
     	    }
     	 
     	 	$this->layout->title = 'Liste des commentaires';
     		$this->layout->main = View::make('dash')->nest('content','comments.list',compact('comments', 'sortby', 'order'));*/
 }
开发者ID:jeremy6680,项目名称:easy-peasy-cms,代码行数:18,代码来源:CommentController.php

示例3: getIndex

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     View::share('title', __(Lang::get('admin.dashboard')));
     $news = News::where('post_type', '=', 1)->orderBy('created_at', 'desc')->take(5)->get();
     $comments = Comment::orderBy('created_at', 'desc')->take(5)->get();
     $users = User::orderBy('created_at', 'desc')->take(5)->get();
     $files = Files::orderBy('created_at', 'desc')->take(5)->get();
     $categories = Category::orderBy('created_at', 'desc')->take(5)->get();
     $pages = News::where('post_type', '=', 2)->orderBy('created_at', 'desc')->take(5)->get();
     View::share('news', $news);
     View::share('comments', $comments);
     View::share('users', $users);
     View::share('files', $files);
     View::share('pages', $pages);
     View::share('categories', $categories);
     $this->setLayout();
     $this->layout->content = View::make('backend.content.dashboard');
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:23,代码来源:AdminHomeController.php

示例4: index

 public function index()
 {
     //get imageslider
     $sliders = Slider::orderBy('created_at', 'desc')->take(5)->get();
     //affiche le post vedette sur la home page avec la categorie prédéfinis
     $headliner = Category::with(['posts' => function ($query) {
         $query->orderBy('published_at', 'DESC')->take(1)->get();
     }])->where('id', '=', '5')->get();
     //show 4 categories with only one post by Category
     $categories = Category::with(['posts' => function ($query) {
         $query->orderBy('published_at', 'DESC')->take(5)->get();
     }])->take(4)->get();
     //Category publicite show image with publicity link
     $pub = Category::orderBy('created_at', 'DESC')->where('id', '=', '6')->take(1)->get();
     //affichage des commentaires par posts
     $comments = Comment::orderBy('created_at', 'desc')->take(6)->get();
     //Retrun 2 post by category check model Category twicePost
     $postCat = Category::with(['posts' => function ($query) {
         // Note that you don't have to call get() here!
         $query->orderBy('published_at', 'desc')->latest();
     }])->take(4)->get();
     return View::make('home.index')->with(array('sliders' => $sliders, 'comments' => $comments, 'categories' => $categories, 'headliner' => $headliner, 'pub' => $pub, 'postCat' => $postCat));
 }
开发者ID:uknowcreation,项目名称:laravelblog,代码行数:23,代码来源:HomeController.php

示例5: listComment

 public function listComment()
 {
     $comments = Comment::orderBy('id', 'desc')->paginate(20);
     $this->layout->title = 'Comment Listings';
     $this->layout->main = View::make('dash')->nest('content', 'comments.list', compact('comments'));
 }
开发者ID:Neal-liu,项目名称:neal-liu.github.io,代码行数:6,代码来源:CommentController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Response::json(Comment::orderBy('id', 'DESC')->get());
 }
开发者ID:nsmith7989,项目名称:spreadsheet,代码行数:9,代码来源:CommentController.php

示例7: index

 public function index()
 {
     $comments = Comment::orderBy('published', 'ASC')->orderBy('created_at', 'DESC')->get();
     return Response::json($comments);
 }
开发者ID:spinybeast,项目名称:cyclone-music-space.ru,代码行数:5,代码来源:CommentController.php

示例8: getCommentsOrdered

 public static function getCommentsOrdered($pagination = 20)
 {
     return Comment::orderBy('id', 'desc')->paginate($pagination);
 }
开发者ID:rituzy,项目名称:iblog,代码行数:4,代码来源:Comment.php

示例9: getAllComments

 public function getAllComments()
 {
     $comments = Comment::orderBy('created_at', 'desc')->with('user', 'image')->paginate(50);
     return View::make('admin/allcomments/index')->with('comments', $comments);
 }
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:5,代码来源:AdminController.php

示例10: function

View::composer('view_user_profile', function ($view) {
    $id = $view->getData()["id"];
    $data["user"] = User::findOrFail($id);
    $data["posts"] = $data["user"]->posts()->get();
    $data["comments"] = $data["user"]->comments()->get();
    $view->with('data', $data);
});
View::composer('article_edit', function ($view) {
    $id = $view->getData()["data"]["id"];
    if (isset($view->getData()["data"]["message"])) {
        $data["message"] = $view->getData()["data"]["message"];
    }
    $data["post"] = Post::findOrFail($id);
    $view->with('data', $data);
});
View::composer('category_view', function ($view) {
    $id = $view->getData()["id"];
    $data["category"] = Category::findOrFail($id);
    $data["posts"] = $data["category"]->post()->paginate(5);
    $view->with('data', $data);
});
View::composer('admin_page', function ($view) {
    $data["posts"] = Post::orderBy('id', 'DESC')->get()->take(10);
    $data["unmoderated"] = Post::where('moderated', '=', false)->orderBY('id', 'DESC')->get()->take(10);
    $data["comments"] = Comment::orderBy('id', 'DESC')->get()->take(10);
    $view->with('data', $data);
});
View::composer('manage_users', function ($view) {
    $data["users"] = User::orderBy('id', 'DESC')->paginate(5);
    $view->with('data', $data);
});
开发者ID:jtaurus,项目名称:jtauri_blog,代码行数:31,代码来源:composers.php


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