本文整理汇总了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');
}
示例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'));*/
}
示例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');
}
示例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));
}
示例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'));
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return Response::json(Comment::orderBy('id', 'DESC')->get());
}
示例7: index
public function index()
{
$comments = Comment::orderBy('published', 'ASC')->orderBy('created_at', 'DESC')->get();
return Response::json($comments);
}
示例8: getCommentsOrdered
public static function getCommentsOrdered($pagination = 20)
{
return Comment::orderBy('id', 'desc')->paginate($pagination);
}
示例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);
}
示例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);
});