Files
omg-wtf-ai/app/Providers/AppServiceProvider.php
2026-08-09 04:19:21 +03:00

36 lines
951 B
PHP

<?php
namespace App\Providers;
use App\Models\Page;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Always generate absolute URLs (route(), url(), canonical tags, sitemap,
// JSON-LD, ...) from the configured APP_URL, not the incoming request's
// Host header. Without this, www vs apex requests each produce
// self-referencing canonical URLs for identical content.
URL::forceRootUrl(config('app.url'));
View::composer('components.layouts.app', function ($view) {
$view->with('footerPages', Page::published()->inFooter()->get());
});
}
}