Inheritance: use trait Illuminate\Foundation\Bus\DispatchesJobs
Ejemplo n.º 1
0
 public function __construct($db)
 {
     parent::__construct($db);
     $this->accountService = new AccountService($db);
 }
Ejemplo n.º 2
0
 public function bulk($ids, $action, $params = [])
 {
     if ($action == 'refund') {
         if (!$ids) {
             return 0;
         }
         $payments = $this->getRepo()->findByPublicIdsWithTrashed($ids);
         $successful = 0;
         foreach ($payments as $payment) {
             if (Auth::user()->can('edit', $payment)) {
                 $amount = !empty($params['amount']) ? floatval($params['amount']) : null;
                 $accountGateway = $payment->account_gateway;
                 $paymentDriver = $accountGateway->paymentDriver();
                 if ($paymentDriver->refundPayment($payment, $amount)) {
                     $successful++;
                 }
             }
         }
         return $successful;
     } else {
         return parent::bulk($ids, $action);
     }
 }