Add with parameter in Contact object to retrieve contact fields (#1044)

This commit is contained in:
Régis Freyd
2018-03-23 22:12:12 -04:00
committed by GitHub
parent d1559d9e60
commit ce7ecf5adc
6 changed files with 178 additions and 0 deletions
@@ -28,6 +28,11 @@ class ApiController extends Controller
*/
protected $sort = 'created_at';
/**
* @var string
*/
protected $withParameter = null;
/**
* @var string
*/
@@ -59,6 +64,10 @@ class ApiController extends Controller
$this->setLimitPerPage($request->get('limit'));
}
if ($request->has('with')) {
$this->setWithParameter($request->get('with'));
}
// make sure the JSON is well formatted if the given call sends a JSON
// TODO: there is probably a much better way to do that
if ($request->method() != 'GET' && $request->method() != 'DELETE'
@@ -104,6 +113,25 @@ class ApiController extends Controller
return $this;
}
/**
* @return string
*/
public function getWithParameter()
{
return $this->withParameter;
}
/**
* @param string $with
* @return $this
*/
public function setWithParameter($with)
{
$this->withParameter = $with;
return $this;
}
/**
* @return int
*/