1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Services/AccountGatewayService.php
2015-11-06 00:37:04 +02:00

68 lines
1.6 KiB
PHP

<?php namespace App\Services;
use URL;
use App\Models\Gateway;
use App\Services\BaseService;
use App\Ninja\Repositories\AccountGatewayRepository;
class AccountGatewayService extends BaseService
{
protected $accountGatewayRepo;
protected $datatableService;
public function __construct(AccountGatewayRepository $accountGatewayRepo, DatatableService $datatableService)
{
$this->accountGatewayRepo = $accountGatewayRepo;
$this->datatableService = $datatableService;
}
protected function getRepo()
{
return $this->accountGatewayRepo;
}
/*
public function save()
{
return null;
}
*/
public function getDatatable($accountId)
{
$query = $this->accountGatewayRepo->find($accountId);
return $this->createDatatable(ENTITY_ACCOUNT_GATEWAY, $query, false);
}
protected function getDatatableColumns($entityType, $hideClient)
{
return [
[
'name',
function ($model) {
return link_to("gateways/{$model->public_id}/edit", $model->name);
}
],
[
'payment_type',
function ($model) {
return Gateway::getPrettyPaymentType($model->gateway_id);
}
],
];
}
protected function getDatatableActions($entityType)
{
return [
[
uctrans('texts.edit_gateway'),
function ($model) {
return URL::to("gateways/{$model->public_id}/edit");
}
]
];
}
}