quote->status_id != Quote::STATUS_DRAFT) { return $this->quote; } $this->quote->markInvitationsSent(); if ($this->quote->due_date != '' || $this->client->getSetting('valid_until') == '') { } else { $this->quote->due_date = Carbon::parse($this->quote->date)->addDays((int)$this->client->getSetting('valid_until')); } $this->quote ->service() ->setStatus(Quote::STATUS_SENT) ->applyNumber() ->save(); event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); if($first_event) { event('eloquent.updated: App\Models\Quote', $this->quote); $this->quote->sendEvent(Webhook::EVENT_SENT_QUOTE, "client"); } return $this->quote; } }