nimuli/app/Http/Controllers/BioPageController.php

24 lines
606 B
PHP

<?php
namespace App\Http\Controllers;
use App\Domains\Bio\Models\BioPage;
use App\Domains\Domain\Models\Domain;
class BioPageController extends Controller
{
public function show(string $slug): \Illuminate\View\View|\Illuminate\Http\Response
{
$host = request()->getHost();
$domain = Domain::where('hostname', $host)->first();
$page = BioPage::where('slug', $slug)
->where('domain_id', $domain?->id)
->where('is_published', true)
->with('blocks')
->firstOrFail();
return view('bio.show', compact('page'));
}
}