company_key = $company_key; $this->endings = explode(",", config('ninja.inbound_mailbox.inbound_mailbox_endings')); } public function passes($attribute, $value) { if (empty ($value)) { return true; } // early return, if we dont have any additional validation if (!config('ninja.inbound_mailbox.inbound_mailbox_endings')) { $this->validated_schema = true; return MultiDB::checkInboundMailboxAvailable($value); } // Validate Schema $validated = false; foreach ($this->endings as $ending) { if (str_ends_with($ending, $value)) { $validated = true; break; } } if (!$validated) return false; $this->validated_schema = true; return MultiDB::checkInboundMailboxAvailable($value); } /** * @return string */ public function message() { if (!$this->validated_schema) return ctrans('texts.inbound_mailbox_invalid'); return ctrans('texts.inbound_mailbox_taken'); } }