kawax/packagist-bot

View on GitHub
app/Jobs/NotifyJob.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Notification;

class NotifyJob
{
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;
    use SerializesModels;

    /**
     * @var \Illuminate\Notifications\Notification
     */
    protected $notify;

    /**
     * Create a new job instance.
     *
     * @param  \Illuminate\Notifications\Notification
     *
     * @return void
     */
    public function __construct($notify)
    {
        $this->notify = $notify;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Notification::route('discord', config('services.discord.channel'))
                    ->notify($this->notify);
    }
}