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

36 lines
742 B
PHP

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