ok

Mini Shell

Direktori : /home2/selectio/www/fms-worksuite/app/Observers/
Upload File :
Current File : //home2/selectio/www/fms-worksuite/app/Observers/RemovalRequestLeadObserver.php

<?php

namespace App\Observers;

use App\Events\RemovalRequestAdminLeadEvent;
use App\Events\RemovalRequestApprovedRejectLeadEvent;
use App\Models\RemovalRequestLead;
use Illuminate\Support\Facades\Log;

class RemovalRequestLeadObserver
{

    public function created(RemovalRequestLead $removalRequestLead)
    {
        if (!isRunningInConsoleOrSeeding()) {
            event(new RemovalRequestAdminLeadEvent($removalRequestLead));
        }
    }

    public function updated(RemovalRequestLead $removal)
    {
        if (!isRunningInConsoleOrSeeding()) {
            try {
                if ($removal->lead) {
                    event(new RemovalRequestApprovedRejectLeadEvent($removal));
                }
            } catch (\Exception $e) {
                Log::info($e);
            }
        }
    }

    public function creating(RemovalRequestLead $model)
    {
        if (company()) {
            $model->company_id = company()->id;
        }
    }

}

Zerion Mini Shell 1.0