Add method that makes sure that URL's are expanded for page navigation/

This commit is contained in:
James Cole 2018-02-16 14:51:59 +01:00
parent 22fdc81de2
commit d3294be1bc
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -61,6 +61,32 @@ class Controller extends BaseController
$this->parameters = $this->getParameters();
}
/**
* @return string
*/
protected function buildParams(): string
{
$return = '?';
$params = [];
foreach ($this->parameters as $key => $value) {
if($key === 'page') {
continue;
}
if ($value instanceof Carbon) {
$params[$key] = $value->format('Y-m-d');
}
if (!$value instanceof Carbon) {
$params[$key] = $value;
}
}
$return .= http_build_query($params);
if (strlen($return) === 1) {
return '';
}
return $return;
}
/**
* @return ParameterBag
*/