setupSeo(); } /** * Setup SEO data from attributes and share it globally. */ protected function setupSeo(): void { $reflection = new \ReflectionClass($this); $attributes = $reflection->getAttributes(SeoDataAttribute::class); if (!empty($attributes)) { $seoDataAttribute = $attributes[0]->newInstance(); $seoData = $seoDataAttribute->resolve(); } else { $seoData = SeoDataAttribute::getData('default'); } View::share('SEOData', $seoData); } }