vendor->number)) { return $this; } do { try { $this->vendor->number = $this->getNextVendorNumber($this->vendor); $this->vendor->saveQuietly(); $this->completed = false; } catch (QueryException $e) { $x++; if ($x > 50) { $this->completed = false; } } } while ($this->completed); return $this; } /** * Saves the vendor instance * * @return Vendor The Vendor Model */ public function save(): Vendor { $this->vendor->saveQuietly(); return $this->vendor->fresh(); } }