]> _ Git - psq.git/commitdiff
notificaiton on register discover
authorLouis Jeckel <louis.jeckel@outlook.com>
Mon, 26 Oct 2020 12:58:22 +0000 (13:58 +0100)
committerLouis Jeckel <louis.jeckel@outlook.com>
Mon, 26 Oct 2020 12:58:22 +0000 (13:58 +0100)
app/Http/Controllers/Auth/RegisterController.php
app/Http/Controllers/ContactController.php
app/Notifications/NewTrialUser.php [new file with mode: 0644]
config/app.php
routes/admin.php

index c25e7ac13e15a61f86aca3c121fd62c58daf566c..bd1e9cdae5fb31c0e5b08ca5a5dfdb67fa359d33 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Http\Controllers\Auth;
 
 use App\Http\Controllers\Controller;
+use App\Notifications\NewTrialUser;
 use App\Providers\RouteServiceProvider;
 use App\User;
 use \Illuminate\Database\Query\Builder;
@@ -111,6 +112,12 @@ class RegisterController extends Controller
             ]
         );
 
+        //If users requested a trial period
+        if($type === User::TYPE_DISCOVER) {
+            \Notification::route('mail', config('app.emails.subscriptions'))
+                ->notify(new NewTrialUser($user));
+        }
+
 
         return $user;
     }
index f017df7fb8844fdcff8060145ee5ae2112ea6229..42f5e28d72f6d3769e497a5f15f0d522e91e945e 100644 (file)
@@ -31,7 +31,7 @@ class ContactController extends Controller
 
          $contactRequest = new ContactRequest($request->all());
          $contactRequest->save();
-        \Notification::route('mail', 'olivier.robichon@prescription-quotidien.com')
+        \Notification::route('mail', config('app.emails.olivier'))
             ->notify(new \App\Notifications\ContactRequest($contactRequest));
 
         \Session::flash('message', "Votre demande a bien été prise en compte, nous reviendrons vers vous dans les plus brefs délais. Merci de l'intérêt que vous portez à Prescription Santé - Le Quotidien !");
diff --git a/app/Notifications/NewTrialUser.php b/app/Notifications/NewTrialUser.php
new file mode 100644 (file)
index 0000000..189a8b1
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Notifications;
+
+use App\User;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Notification;
+
+class NewTrialUser extends Notification
+{
+    use Queueable;
+
+    /**
+     * @var User
+     */
+    private User $user;
+
+    /**
+     * Create a new notification instance.
+     *
+     * @param User $user
+     */
+    public function __construct(User $user)
+    {
+        $this->user = $user;
+    }
+
+    /**
+     * Get the notification's delivery channels.
+     *
+     * @param  mixed  $notifiable
+     * @return array
+     */
+    public function via($notifiable)
+    {
+        return ['mail'];
+    }
+
+    /**
+     * Get the mail representation of the notification.
+     *
+     * @param  mixed  $notifiable
+     * @return \Illuminate\Notifications\Messages\MailMessage
+     */
+    public function toMail($notifiable)
+    {
+        return (new MailMessage)
+            ->greeting('')
+            ->subject("{$this->user->name} à fait une demande de période découverte.")
+            ->line("{$this->user->name} à fait une demande de période découverte.")
+            ->action("Accéder au CRM", "https://admin.prescription-quotidien.com/crm");
+
+    }
+
+    /**
+     * Get the array representation of the notification.
+     *
+     * @param  mixed  $notifiable
+     * @return array
+     */
+    public function toArray($notifiable)
+    {
+        return [
+            //
+        ];
+    }
+}
index b464dc2d7c4ca5cf452e478e3fbdc82bf74f6a6f..76d9bc18de81106244c6861835f5fba8a66171a4 100644 (file)
@@ -125,7 +125,12 @@ return [
 
     'aws_s3_url' => 'https://prescription-sante.s3.eu-west-3.amazonaws.com',
 
-    'version' => '0.6.1 beta 4',
+    'version' => '0.6.2 beta 4',
+
+    'emails' => [
+        'subscriptions' => 'abonnement@prescription-quotidien.com',
+        'olivier' => 'olivier.robichon@prescription-quotidien.com',
+    ],
 
 
     /*
index 16143fbc06a41600a5ca9cf360da70c534130d6e..678f50ef1542bd59e554c98b6da4ad82a293f866 100644 (file)
@@ -6,13 +6,13 @@ Route::module('pdfFiles');
 /** Dynamic content */
 Route::prefix('content')->group(function() {
     Route::module('pdfFiles');
-    Route::module('articles');
+//    Route::module('articles');
     Route::module('adCampaigns');
     Route::module('events');
     Route::module('podcasts');
     Route::module('laboArticles');
     Route::module('weeklyAgendas');
-    Route::module('eventImages');
+//    Route::module('eventImages');
     Route::module('humeurs');
     Route::module('guests'); //podcast guests