validCreditsPresent(); } /** * @return string */ public function message() { return 'Insufficient balance on credit.'; } private function validCreditsPresent() :bool { //todo need to ensure the clients credits are here not random ones! if(request()->input('credits') && is_array(request()->input('credits'))) { foreach(request()->input('credits') as $credit) { $cred = Credit::find($this->decodePrimaryKey($credit['credit_id'])); if($cred->balance == 0) return false; } } return true; } }