public function get_list()
{
$resellers = DB::select('*')->from('resellers');
if(Input::get('id')) $resellers->where('id', '=', Input::get('id'));
if(Input::get('name')) $resellers->where('nome', '=', Input::get('name'));
if(Input::get('surname')) $resellers->where('cognome', '=', Input::get('surname'));
if(Input::get('company')) $resellers->where('azienda', 'like', '%'.Input::get('company').'%');
$result = $resellers->execute();
$this->response($result);
}
[{"id":"25","nome":"Name1","cognome":"Surname1","azienda":"Company1"}, "id":"26","nome":"Name2","cognome":"Surname2","azienda":"Company2"}]
public function get_list()
{
$resellers = \Model_Reseller::find('all');
$result = Format::factory($resellers)->to_array();
$this->response($result);
}
{"25":{"id":"25","nome":"Name1","cognome":"Surname1","azienda":"Company1"},"26": "id":"26","nome":"Name2","cognome":"Surname2","azienda":"Company2"}}
It looks like you're new here. If you want to get involved, click one of these buttons!