Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Listeners; use App\Jobs\MailSend; use App\Models\Emailtpl; use App\M..
Decoded Output download
<?php
namespace App\Listeners;
use App\Jobs\MailSend;
use App\Models\Emailtpl;
use App\Models\Order;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Events\OrderUpdated as OrderUpdatedEvent;
class OrderUpdated
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle(OrderUpdatedEvent $event)
{
$sysCache = cache('system-setting');
//
$order = [
'created_at' => date('Y-m-d H:i'),
'ord_title' => $event->order->title,
'webname' => $sysCache['text_logo'] ?? '',
'weburl' => config('app.url'),
'order_id' => $event->order->order_sn,
'ord_price' => $event->order->actual_price,
'ord_info' => str_replace(PHP_EOL, '<br/>', $event->order->info)
];
$to = $event->order->email;
//
if ($event->order->type == Order::MANUAL_PROCESSING) {
switch ($event->order->status) {
case Order::STATUS_PENDING:
$mailtpl = Emailtpl::query()->where('tpl_token', 'pending_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
case Order::STATUS_COMPLETED:
$mailtpl = Emailtpl::query()->where('tpl_token', 'completed_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
case Order::STATUS_FAILURE:
$mailtpl = Emailtpl::query()->where('tpl_token', 'failed_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
}
}
}
/**
*
*
* @param array $mailtpl
* @param array $order
* @param string $to
*
* @author assimon<[email protected]>
* @copyright assimon<[email protected]>
* @link http://utf8.hk/
*/
private static function sendMailToOrderStatus(array $mailtpl, array $order, string $to) :void
{
$info = replace_mail_tpl($mailtpl, $order);
MailSend::dispatch($to, $info['tpl_name'], $info['tpl_content']);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Listeners;
use App\Jobs\MailSend;
use App\Models\Emailtpl;
use App\Models\Order;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Events\OrderUpdated as OrderUpdatedEvent;
class OrderUpdated
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle(OrderUpdatedEvent $event)
{
$sysCache = cache('system-setting');
//
$order = [
'created_at' => date('Y-m-d H:i'),
'ord_title' => $event->order->title,
'webname' => $sysCache['text_logo'] ?? '',
'weburl' => config('app.url'),
'order_id' => $event->order->order_sn,
'ord_price' => $event->order->actual_price,
'ord_info' => str_replace(PHP_EOL, '<br/>', $event->order->info)
];
$to = $event->order->email;
//
if ($event->order->type == Order::MANUAL_PROCESSING) {
switch ($event->order->status) {
case Order::STATUS_PENDING:
$mailtpl = Emailtpl::query()->where('tpl_token', 'pending_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
case Order::STATUS_COMPLETED:
$mailtpl = Emailtpl::query()->where('tpl_token', 'completed_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
case Order::STATUS_FAILURE:
$mailtpl = Emailtpl::query()->where('tpl_token', 'failed_order')->first()->toArray();
self::sendMailToOrderStatus($mailtpl, $order, $to);
break;
}
}
}
/**
*
*
* @param array $mailtpl
* @param array $order
* @param string $to
*
* @author assimon<[email protected]>
* @copyright assimon<[email protected]>
* @link http://utf8.hk/
*/
private static function sendMailToOrderStatus(array $mailtpl, array $order, string $to) :void
{
$info = replace_mail_tpl($mailtpl, $order);
MailSend::dispatch($to, $info['tpl_name'], $info['tpl_content']);
}
}
Function Calls
None |
Stats
MD5 | 51c8ecad396aa6567ad4d9f7f0f76f4d |
Eval Count | 0 |
Decode Time | 109 ms |