public function index($collection = NULL) { if (is_null($collection)) { return $this->all(); } $products = Product::getByCollection($collection)->toArray(); return $this->layout(hbs('content/product-list-grouped', [$products])); }