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($this->client->getSetting('valid_until')); } $this->quote ->service() ->setStatus(Quote::STATUS_SENT) ->applyNumber() ->deletePdf() ->save(); event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); $this->quote->sendEvent(Webhook::EVENT_SENT_QUOTE, "client"); return $this->quote; } }