php - Restler get/index with optional value -


I am trying to define a method with Restler so that I ... / clients / 123 then this specific customer gives, and if I leave 123 then it returns to all the customers I tried it:

  / ** * @most int $ id SQL identifier * / function index ($ id = null) {}  

If I do this, then it works with query parameter : ... / clients? Id = 123

Then when I add {@ from path} at the end of that @param, so that I can use a query string, specify it Does not work with the value, but what does the correct way of doing this with the 123 specification that I was given as a path instead of the query parameter?

To obtain a collection, one of the best practices is reserved as the reserved index and the specific ID Use

  function index () {return Client :: All () - & gt; ToArray (); } Get function ($ ID) {return Client :: Search ($ ID) - & gt; ToArray (); }  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -