コード例 #1
0
ファイル: ServerApi.php プロジェクト: shypeter/pvmovie
 private function _add_movie()
 {
     $movie = Request::input('movie');
     $note = Request::input('note');
     $uid = Tools::getUserIDByEmail(Auth::user()->email);
     $wl = new WishList();
     $wl->movie = $movie;
     $wl->note = $note;
     $wl->user_id = $uid;
     $result = $wl->save();
     echo json_encode(array("status" => $result, "movie" => $movie, "note" => $note, "name" => Auth::user()->name, 'created_at' => date('Y-m-d H:i:s')));
 }
コード例 #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);
 }