Optimierung 4.3/4.4 (Home): Page-Data-Service + Invokable Controller
Startseiten-Datenaufbereitung ($webHomeData) in HomePageData; die Edition-Home- Route nutzt Web\HomeController (pressekonto-Redirect + Portal->View-Mapping). Damit ist routes/web.php von ~1080 auf ~230 Zeilen geschrumpft; alle datengetriebenen Seiten laufen jetzt ueber schlanke Invokable Controller + Page-Data-Services. Verhalten unveraendert, 92 Web-Tests gruen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e879a38ee4
commit
43c83ca32d
3 changed files with 277 additions and 243 deletions
29
app/Http/Controllers/Web/HomeController.php
Normal file
29
app/Http/Controllers/Web/HomeController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Web\HomePageData;
|
||||
use App\Support\WebPortalContext;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function __invoke(HomePageData $pageData): View|RedirectResponse
|
||||
{
|
||||
// Der Hub (pressekonto) hat keine Ausgaben-Startseite; auf die Bare-Root.
|
||||
if (str_contains(request()->getHost(), 'pressekonto')) {
|
||||
return redirect(request()->getSchemeAndHttpHost().'/', 301);
|
||||
}
|
||||
|
||||
$context = WebPortalContext::fromRequest();
|
||||
|
||||
$view = $context->portal === Portal::Presseecho
|
||||
? 'web.presseecho'
|
||||
: 'web.businessportal24';
|
||||
|
||||
return view($view, $pageData->build($context->portal, $context->language));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue