<?php

namespace App\Listeners;

use App\Models\Promotion;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Notifications\PromotionNotification;
use Illuminate\Support\Facades\Notification;
class SendPromotionNotification
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle($event)
    {
      $titre =  Promotion::where('fin', '<', \Carbon\Carbon::now())->get();

          Notification::send($titre, new PromotionNotification($event->titre));
    }

}
