]> _ Git - psq.git/commitdiff
newsletter
authorLouis Jeckel <louis.jeckel@outlook.com>
Wed, 18 Nov 2020 10:17:59 +0000 (11:17 +0100)
committerLouis Jeckel <louis.jeckel@outlook.com>
Wed, 18 Nov 2020 10:17:59 +0000 (11:17 +0100)
app/Http/Controllers/Admin/UnlayerController.php
app/Nova/EmailTemplate.php

index 4b8e762604520c656db653c9fb109dc4b33d07d8..023963fb414ac294b8352d9aed2aa2ba0a871ac4 100644 (file)
@@ -24,20 +24,28 @@ class UnlayerController
     }
 
     public function links()
+    {
+        return self::getLinks();
+    }
+
+    public static function getLinks()
     {
         $classes = collect([
             Poll::class => 'Sondage',
-            LaboArticle::class => 'Article Labo',
+            LaboArticle::class => 'Actu Labo',
             SocialArticle::class => 'Article réseaux sociaux',
             AdCampaign::class => 'Campagnes'
         ]);
 
-        return $classes->map(function ($label, $class) {
+        return collect([[
+            'name' => 'Liens',
+            'specialLinks' => self::getIndexLinks()
+        ]])->merge($classes->map(function ($label, $class) {
             return [
                 'name' => $label,
                 'specialLinks' => self::getLinksForClass($class, 5)
             ];
-        })->values();
+        })->values());
 
     }
 
@@ -48,4 +56,18 @@ class UnlayerController
         return $items->map(fn($item) => ['name' => mb_strimwidth($item->title, 0, 35, '…'), 'href' => $item->url]);
     }
 
+    public static function getIndexLinks()
+    {
+        $links = collect([
+            'Accueil' => route('home'),
+            'Inscription découverte' => route('discover.register'),
+            'Form. Contact' => route('contact.index'),
+            'Actus Labo' => route('actus-labos.index'),
+            'Article réseaux sociaux' => route('actus-labos.index'),
+            'Campagnes' => route('com-campaign.index')
+        ]);
+
+        return $links->map(fn($route, $label) => ['name' => $label, 'href' => $route])->values();
+    }
+
 }
index 4f562948ee137d7eda2d5124904cc609a40cfcc0..1ff4dd1ad26b0e32a3cd56c19346619b3bd5902c 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace App\Nova;
 
+use App\Http\Controllers\Admin\UnlayerController;
 use IDF\NovaUnlayerField\Unlayer;
 use Illuminate\Http\Request;
 use Laravel\Nova\Fields\Boolean;
@@ -67,16 +68,7 @@ class EmailTemplate extends Resource
                 'projectId' => config('services.unlayer.projectId'),
                 'templateId' => $this->design === null ? 20390 : null,
                 'locale' => app()->getLocale(),
-                'specialLinks' => [
-                    [
-                        'name' => 'Home',
-                        'href' => route('home'),
-                    ],
-                    [
-                        'name' => 'Contact',
-                        'href' => route('contact.index')
-                    ],
-                ],
+                'specialLinks' => UnlayerController::getLinks(),
                 'tools' => [
                     'menu' => [
                         'enabled' => false,