Esempio n. 1
0
 public function getCommentsByIdArticle($id)
 {
     return Cache::store($this->store)->rememberForever($id, function () use($id) {
         $data = [];
         $comments_model = new CommentsModel();
         $comments = $comments_model->published()->commentsByArticleId($id)->orderByParam()->get();
         foreach ($comments as $coment) {
             $data[] = ['id' => $coment->id, 'user' => $coment->user, 'message' => $coment->message, 'answer' => $coment->answer];
         }
         return $data;
     });
 }
Esempio n. 2
0
 public function Select(\Illuminate\Http\Request $request)
 {
     $movies = $request->input('coucou');
     dump($movies);
     if (count($movies) == 0) {
         Session::flash('warning', "Aucun film sélectionné");
     } else {
         switch (Input::get('selectors')) {
             case 0:
                 if ($movies == null) {
                 } else {
                     Session::flash('warning', "Selectionne une action");
                 }
                 break;
             case 1:
                 foreach ($movies as $id) {
                     $movie = commentdb::find($id);
                     $movie->delete();
                 }
                 Session::flash('success', "Les films sont supprimé");
                 break;
             case 2:
                 foreach ($movies as $id) {
                     $movie = commentdb::find($id);
                     $movie->state = 1;
                     $movie->save();
                 }
                 Session::flash('success', "Les films sont visible");
                 break;
             case 3:
                 foreach ($movies as $id) {
                     $movie = commentdb::find($id);
                     $movie->state = 0;
                     $movie->save();
                 }
                 Session::flash('success', "Les films sont invisible");
                 break;
         }
     }
     return Redirect::route('comments.index');
 }
Esempio n. 3
0
 public function show()
 {
     $comments = Comments::all();
     return view('comments', ['comments' => $comments]);
 }