static function search() { $buyers = Buyer::orderBy('created_at', 'DESC'); $q = Input::get('q'); $param = Input::get('param'); if ($q and $param) { if ($param == "email") { $buyers = $buyers->where("email", '=', $q); } if ($param == "fname") { $buyers = $buyers->where("first_name", '=', $q); } if ($param == "lname") { $buyers = $buyers->where("last_name", '=', $q); } } return $buyers->paginate(25); }
public function order($id) { $orderCake = Cake::find($id); $buyer = Buyer::orderBy('created_at', 'desc')->first(); $fbID = $buyer->fbID; $select = Cake::where('id', '=', $id)->get(); $order = new Order(); $name = $select['name']; $price = $select['price']; $category = $select['category']; $description = $select['description']; $fbID = $fbID; $image = $select['image']; $order->name = $name; $order->price = $price; $order->category = $category; $order->description = $description; $order->buyersID = $fbID; $order->image = $image; $order->save(); return Redirect::to('myaccountBuyer'); }