public function products(Request $request) { $limit = $request->input('limit'); $page = $request->input('page'); // print_r($request->input()); // echo(is_numeric($limit)==false); // echo($limit.$page); if ($limit != null && $page != null && count($request->input()) == 2 && is_numeric($limit) == true && is_numeric($page) == true) { $todos = ProductModel::paginate($limit); return ['message' => 'OK', 'state' => 'list of all products', 'result' => $todos->toArray()]; } else { return response('Invalid Argument', 400); } }