input = $input; } public function passes($attribute, $value) { return $this->checkCreditTotals(); } private function checkCreditTotals() { if( array_sum(array_column($this->input['credits'],'amount')) > array_sum(array_column($this->input['invoices'], 'amount'))) return false; return true; } /** * @return string */ public function message() { return "Total credits applied cannot be MORE than total of invoices"; } }