48 lines
980 B
PHP
48 lines
980 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\StoicPage;
|
|
use App\Support\StorePlaceholders;
|
|
|
|
class LegalPageController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly StorePlaceholders $placeholders,
|
|
) {}
|
|
|
|
public function terms(string $locale)
|
|
{
|
|
return $this->show('terms-and-conditions');
|
|
}
|
|
|
|
public function shippingReturns(string $locale)
|
|
{
|
|
return $this->show('shipping-returns');
|
|
}
|
|
|
|
public function privacy(string $locale)
|
|
{
|
|
return $this->show('privacy-policy');
|
|
}
|
|
|
|
public function cookies(string $locale)
|
|
{
|
|
return $this->show('cookies-policy');
|
|
}
|
|
|
|
private function show(string $slug)
|
|
{
|
|
$page = StoicPage::localized($slug);
|
|
|
|
if (! $page) {
|
|
abort(404);
|
|
}
|
|
|
|
return view('legal', [
|
|
'page' => $page,
|
|
'content' => $this->placeholders->fill($page->content ?? ''),
|
|
]);
|
|
}
|
|
}
|