public function show($slug, HumeurRepository $repository)
{
- /** @var Humeur $article */
+ /** @var Humeur $humeur */
$humeur = $repository->forSlug($slug);
abort_if($humeur === null, 404);
+
\View::share('title', $humeur->title);
\View::share('humeur', $humeur);
+ \View::share('meta', $humeur->getMetaData());
return view('en-plus.humeurs.show');
}
* Class Humeur
* @package App\Models
* @property string $link
+ * @property string $title
+ * @property string $content
+ * @property string $extract
+ *
*/
class Humeur extends Model
{
- use HasSlug;
+ use HasSlug, HasMetaTags;
protected $fillable = [
'published',
return route('humeur.show', ['slug' => $this->slug]);
}
+ /**
+ * @return string
+ */
+ protected function getMetaDescription(): string
+ {
+ return $this->extract;
+ }
+
+ /**
+ * @return string
+ */
+ protected function getMetaImage(): string
+ {
+ return asset('/img/humeurs/olivier.jpg');
+ }
+
}