MyHomeCollection/app/Http/Controllers/PublicController.php

25 lines
581 B
PHP
Raw Normal View History

2020-07-24 13:11:21 +02:00
<?php
namespace App\Http\Controllers;
use App\Home;
use Artesaos\SEOTools\Traits\SEOTools as SEOToolsTrait;
2020-07-24 13:11:21 +02:00
class PublicController extends Controller
{
use SEOToolsTrait;
2020-07-24 13:11:21 +02:00
public function show($slug)
{
$home = Home::where('slug', $slug)->firstOrFail();
$this->seo()
->setTitle($home->title)
->setDescription($home->excerpt())
->addImages(array_map(static function($picture) {
return asset($picture);
}, $home->pictures));
2020-07-24 13:11:21 +02:00
return view('public.view', ['home' => $home]);
}
}