'-1d'], ['from' => '-7d'], ['from' => '-30d'], ['from' => '-1y']], $device = null, $port = null) { $this->type = $type; $this->aspect = $aspect; $this->loading = $loading; $this->device = $device; $this->port = $port; $this->graphs = $graphs; $this->title = $title; $this->responsive = $columns == 'responsive'; $this->rowWidth = $this->calculateRowWidth((int) $columns); } /** * Get the view / contents that represent the component. * * @return \Illuminate\Contracts\View\View|\Closure|string */ public function render() { return view('components.graph-row'); } private function calculateRowWidth(int $columns): ?int { if ($this->responsive) { return null; } $max = max(array_column($this->graphs, 'width') + [0]); if (! $max) { $max = $this->aspect == 'wide' ? Graph::DEFAULT_WIDE_WIDTH : Graph::DEFAULT_NORMAL_WIDTH; } // width * columns, unless there is less graphs than columns return $max * min($columns, count($this->graphs)); } }