Example #1
0
 public function index()
 {
     $msg_arr = array();
     $row_data = WishList::with("get_movie_list")->orderBy("id", "DESC")->get();
     foreach ($row_data as $val) {
         $reply_arr = array();
         $sub_row_data = ReplyWishList::with("get_reply")->where('wish_id', '=', $val['id'])->get();
         foreach ($sub_row_data as $sub_val) {
             array_push($reply_arr, array("reply_user" => $sub_val['get_reply']['name'], "message" => $sub_val['message'], "create_at" => Tools::getCreatedAtAttribute($sub_val['created_at'])));
         }
         array_push($msg_arr, array("wishID" => $val['id'], "user" => $val['get_movie_list']['name'], "movieName" => $val['movie'], "note" => $val['note'], "created_at" => Tools::getCreatedAtAttribute($val['created_at']), "available" => $val['available'], "reply_arr" => $reply_arr));
     }
     return view('wishlist.list')->with('msg_arr', $msg_arr);
 }