You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/app/Model/RequestLog.php

31 lines
638 B
PHTML

1 year ago
<?php
declare(strict_types=1);
namespace App\Model;
class RequestLog extends Model
{
protected $table = 'request_logs';
1 year ago
1 year ago
protected $casts = [
'request_data' => 'array',
];
1 year ago
public function generateToken() {
return md5($this->app_id . '_' . $this->request_id);
}
public function getDataValue($key, $defaultValue = null) {
$data = $this->getData();
1 year ago
return $data[$key] ?? $defaultValue;
1 year ago
}
public function getData() {
1 year ago
$data = $this->request_data['data'] ?? null;
1 year ago
if ($data) {
return json_decode($data, true);
}
return [];
}
1 year ago
}