Esempio n. 1
0
 private function _add_reply()
 {
     $msg = Request::input('msg');
     $uid = Tools::getUserIDByEmail(Auth::user()->email);
     $wishID = Request::input('wishid');
     $rw = new ReplyWishList();
     $rw->wish_id = $wishID;
     $rw->user_id = $uid;
     $rw->message = $msg;
     $result = $rw->save();
     echo json_encode(array("status" => $result, "name" => Auth::user()->name, "msg" => $msg, 'wishid' => $wishID, 'created_at' => date('Y-m-d H:i:s')));
 }
Esempio n. 2
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);
 }