App\Ninja\Datatables\PaymentDatatable::actions PHP Method

actions() public method

public actions ( )
    public function actions()
    {
        return [[trans('texts.edit_payment'), function ($model) {
            return URL::to("payments/{$model->public_id}/edit");
        }, function ($model) {
            return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id]);
        }], [trans('texts.refund_payment'), function ($model) {
            $max_refund = number_format($model->amount - $model->refunded, 2);
            $formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
            $symbol = Utils::getFromCache($model->currency_id ? $model->currency_id : 1, 'currencies')->symbol;
            return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}')";
        }, function ($model) {
            return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id]) && $model->payment_status_id >= PAYMENT_STATUS_COMPLETED && $model->refunded < $model->amount && $model->transaction_reference && in_array($model->gateway_id, static::$refundableGateways);
        }]];
    }