Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/./../../app/Providers
الملفات الموجودة في هذا الـ Path:
.
..
AppServiceProvider.php
AuthServiceProvider.php
BroadcastServiceProvider.php
EventServiceProvider.php
MailConfigServiceProvider.php
RouteServiceProvider.php
SettingServiceProvider.php
مشاهدة ملف: AppServiceProvider.php
<?php
namespace App\Providers;
use App\Models\EmailQueue;
use App\Models\MessageLog;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\ServiceProvider;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Queue::after(function (JobProcessed $event) {
$payload = $event->job->payload();
$data = unserialize($payload['data']['command']);
if (isset($data->data)) {
foreach ($data->data as $s) {
if (isset($s->email_queue_id)) {
$emailQueue = EmailQueue::where('id', $s->email_queue_id)->first();
if (!$event->job->hasFailed()) {
EmailQueue::where('id', $emailQueue->id)->update(['delivered_at' => now()]);
if ($emailQueue->random_ref_key) {
MessageLog::where('random_ref_key', $emailQueue->random_ref_key)->update(['queue_id' => $emailQueue->id, 'status' => 'succeed']);
}
} else {
EmailQueue::where('id', $emailQueue->id)->update(['status' => 'failed']);
if ($emailQueue->random_ref_key) {
MessageLog::where('random_ref_key', $emailQueue->random_ref_key)->update(['queue_id' => $emailQueue->id, 'status' => 'failed']);
}
}
}
}
}
});
}
}