/** * 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'); }
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'));*/ }
/** * 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'); }
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)); }
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')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return Response::json(Comment::orderBy('id', 'DESC')->get()); }
public function index() { $comments = Comment::orderBy('published', 'ASC')->orderBy('created_at', 'DESC')->get(); return Response::json($comments); }
public static function getCommentsOrdered($pagination = 20) { return Comment::orderBy('id', 'desc')->paginate($pagination); }
public function getAllComments() { $comments = Comment::orderBy('created_at', 'desc')->with('user', 'image')->paginate(50); return View::make('admin/allcomments/index')->with('comments', $comments); }
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); });