2020-05-29 23:20:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Listeners;
|
|
|
|
|
|
|
|
use App\Events\ApplicationDeniedEvent;
|
2020-06-26 23:32:33 +00:00
|
|
|
use App\Notifications\ApplicationDenied;
|
2020-10-21 00:29:50 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
2020-05-29 23:20:39 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class DenyUser
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create the event listener.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the event.
|
|
|
|
*
|
|
|
|
* @param ApplicationDeniedEvent $event
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle(ApplicationDeniedEvent $event)
|
|
|
|
{
|
|
|
|
$event->application->setStatus('DENIED');
|
2020-10-21 00:29:50 +00:00
|
|
|
Log::info('User ' . $event->application->user->name . ' just had their application denied.');
|
2020-05-29 23:20:39 +00:00
|
|
|
|
2020-06-26 23:32:33 +00:00
|
|
|
$event->application->user->notify(new ApplicationDenied($event->application));
|
2020-10-21 00:29:50 +00:00
|
|
|
|
2020-05-29 23:20:39 +00:00
|
|
|
}
|
|
|
|
}
|