public function show() { $result = ""; $user = Session::get('user_info'); $user_id = $user['user_id']; $result = Post::getUserPost($user_id); if (!empty($result)) { return view("member.show-post", ["user_info" => Session::get('user_info'), "post_list" => $result]); } else { return view("member.show-post", ["user_info" => Session::get('user_info'), "post_list" => ""]); } }
$kind = "Ô tô, xe máy"; $result = Post::where("location", "LIKE", "%{$location}%")->where("category_id", '=', "3")->where("title", 'LIKE', "%{$value}%")->get()->toArray(); break; case '3': $kind = "Nhà đất"; $result = Post::where("location", "LIKE", "%{$location4}")->where("category_id", '=', "1")->orWhere("category_id", '=', "2")->where("title", 'LIKE', "%{$value}%")->get()->toArray(); break; case '4': $kind = "Điện thoại, Laptop"; $result = Post::where("location", "LIKE", "%{$location}%")->where("category_id2", '=', "16")->orWhere("category_id2", '=', "17")->where("title", 'LIKE', "%{$value}%")->get()->toArray(); break; default: break; } if (!empty($result)) { $count = count($result); return View::make("tim_kiem", array("result" => $result, "count" => $count, "kind" => $kind, "key" => $value)); } else { return View::make("tim_kiem", array("result" => "", "kind" => $kind, "key" => $value)); } }); Route::get("/test/{name}/{value}", function ($name, $value) { print_r(Users::whereLike($name, $value)); }); Route::get("member/test2/{user_id}", function ($user_id) { foreach (Post::getUserPost($user_id) as $key => $value) { echo "<p>"; print_r($value); echo "</p>"; } });