mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add system_logs to company gateway transformer
This commit is contained in:
parent
9bc27c05d3
commit
996355a738
@ -378,6 +378,11 @@ class Company extends BaseModel
|
|||||||
return $this->hasMany(SystemLog::class)->orderBy('id', 'DESC')->take(50);
|
return $this->hasMany(SystemLog::class)->orderBy('id', 'DESC')->take(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function system_log_relation()
|
||||||
|
{
|
||||||
|
return $this->hasMany(SystemLog::class)->orderBy('id', 'DESC');
|
||||||
|
}
|
||||||
|
|
||||||
public function tokens_hashed()
|
public function tokens_hashed()
|
||||||
{
|
{
|
||||||
return $this->hasMany(CompanyToken::class);
|
return $this->hasMany(CompanyToken::class);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\GatewayType;
|
||||||
use App\PaymentDrivers\BasePaymentDriver;
|
use App\PaymentDrivers\BasePaymentDriver;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
@ -58,10 +59,12 @@ class CompanyGateway extends BaseModel
|
|||||||
16 => ['card' => 'images/credit_cards/Test-Discover-Icon.png', 'text' => 'Discover'],
|
16 => ['card' => 'images/credit_cards/Test-Discover-Icon.png', 'text' => 'Discover'],
|
||||||
];
|
];
|
||||||
|
|
||||||
// public function getFeesAndLimitsAttribute()
|
public $gateway_consts = [
|
||||||
// {
|
'38f2c48af60c7dd69e04248cbb24c36e' => 300,
|
||||||
// return json_decode($this->attributes['fees_and_limits']);
|
'd14dd26a37cecc30fdd65700bfb55b23' => 301,
|
||||||
// }
|
'3758e7f7c6f4cecf0f4f348b9a00f456' => 304,
|
||||||
|
'3b6621f970ab18887c4f6dca78d3f8bb' => 305,
|
||||||
|
];
|
||||||
|
|
||||||
protected $touches = [];
|
protected $touches = [];
|
||||||
|
|
||||||
@ -70,6 +73,15 @@ class CompanyGateway extends BaseModel
|
|||||||
return self::class;
|
return self::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function system_logs()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->company
|
||||||
|
->system_log_relation
|
||||||
|
->where('type_id', $this->gateway_consts[$this->gateway->key])
|
||||||
|
->take(50);
|
||||||
|
}
|
||||||
|
|
||||||
public function company()
|
public function company()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
use App\Transformers\SystemLogTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
@ -33,6 +35,7 @@ class CompanyGatewayTransformer extends EntityTransformer
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
|
'system_logs',
|
||||||
'gateway',
|
'gateway',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -81,4 +84,11 @@ class CompanyGatewayTransformer extends EntityTransformer
|
|||||||
|
|
||||||
return $this->includeItem($company_gateway->gateway, $transformer, Gateway::class);
|
return $this->includeItem($company_gateway->gateway, $transformer, Gateway::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeSystemLogs(CompanyGateway $company_gateway)
|
||||||
|
{
|
||||||
|
$transformer = new SystemLogTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($company_gateway->system_logs(), $transformer, SystemLog::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user