parentAttributes = new Attributes(); } public static function create(string $name, array $data = []): static { $view = new static($name, $data); if (array_key_exists('url', $data)) { $view->setUrl($data['url']); } return $view; } public function render(): string { return view($this->name) ->with($this->data + ['active' => $this->isActive()]) ->render(); } public function getName(): string { return $this->name; } public function getData(): array { return $this->data; } }