]> _ Git - psq.git/commitdiff
add meta to humeur
authorLouis Jeckel <louis.jeckel@outlook.cm>
Mon, 14 Sep 2020 14:20:55 +0000 (16:20 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Mon, 14 Sep 2020 14:20:55 +0000 (16:20 +0200)
app/Http/Controllers/HumeurController.php
app/Models/Humeur.php
resources/views/admin/laboArticles/form.blade.php

index ee1c9ea37e833b81a85b81477db2ba4e8d017052..a565e77200883c895647b40b3165c4ec3f809713 100644 (file)
@@ -19,11 +19,13 @@ class HumeurController extends Controller
 
     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');
 
     }
index e47af4d0e8090af05d70ebcda920db4b12586333..62ae34932279df716e6a95755e949d3e900ff096 100644 (file)
@@ -9,10 +9,14 @@ use A17\Twill\Models\Model;
  * 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',
@@ -35,4 +39,20 @@ class Humeur extends Model
         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');
+    }
+
 }
index 05671d146e2692869bc426ec8f5ac36fb41d17de..fcc167454eb224e53193bb0ddd700ba6aeb382d8 100644 (file)
@@ -38,7 +38,7 @@
         'label' => 'Image',
         'max' => 1,
     ])
-    
+
     @formField('ckeditor', [
         'label' => 'Article complet',
         'name' => 'content',