forked from miguel456/rbrecruiter
Beta version
This commit is too large to list all changes.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ApplicationDeniedEvent;
|
||||
use App\Notifications\ApplicationDenied;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -30,6 +31,7 @@ class DenyUser
|
||||
$event->application->setStatus('DENIED');
|
||||
Log::info('User ' . $event->application->user->name . ' just had their application denied.');
|
||||
|
||||
// Also dispatch other notifications
|
||||
$event->application->user->notify(new ApplicationDenied($event->application));
|
||||
|
||||
}
|
||||
}
|
||||
|
46
app/Listeners/OnUserBanned.php
Normal file
46
app/Listeners/OnUserBanned.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use App\Events\UserBannedEvent;
|
||||
use App\Notifications\UserBanned;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\User;
|
||||
|
||||
class OnUserBanned
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(UserBannedEvent $event)
|
||||
{
|
||||
|
||||
Log::warning("User " . $event->user->name . " has just been banned from the site!");
|
||||
|
||||
foreach(User::all() as $user)
|
||||
{
|
||||
if ($user->isStaffMember())
|
||||
{
|
||||
$user->notify((new UserBanned($event->user, $event->ban))->delay(now()->addSeconds(10)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -7,6 +7,9 @@ use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
use App\User;
|
||||
use App\Notifications\NewUser;
|
||||
|
||||
class OnUserRegistration
|
||||
{
|
||||
/**
|
||||
@@ -29,5 +32,13 @@ class OnUserRegistration
|
||||
{
|
||||
// TODO: Send push notification to online admins via browser (w/ pusher)
|
||||
Log::info('User ' . $event->user->name . ' has just registered for an account.');
|
||||
|
||||
foreach(User::all() as $user)
|
||||
{
|
||||
if ($user->hasRole('admin'))
|
||||
{
|
||||
$user->notify(new NewUser($event->user));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace App\Listeners;
|
||||
|
||||
use App\Events\ApplicationApprovedEvent;
|
||||
use App\StaffProfile;
|
||||
use App\Notifications\ApplicationApproved;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -37,11 +38,15 @@ class PromoteUser
|
||||
'memberNotes' => 'Approved by staff members. Welcome them to the team!'
|
||||
]);
|
||||
|
||||
$event->application->user->assignRole('reviewer');
|
||||
|
||||
Log::info('User ' . $event->application->user->name . ' has just been promoted!', [
|
||||
'newRank' => $event->application->response->vacancy->permissionGroupName,
|
||||
'staffProfileID' => $staffProfile->id
|
||||
]);
|
||||
// TODO: Dispatch alert email and notifications for the user and staff members
|
||||
|
||||
$event->application->user->notify(new ApplicationApproved($event->application));
|
||||
// note: Also notify staff
|
||||
// TODO: Also assign new app role based on the permission group name
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user