client = $client; $this->quote = $quote; } public function run() { /* Return immediately if status is not draft */ if ($this->quote->status_id != Quote::STATUS_DRAFT) { return $this->quote; } $this->quote->markInvitationsSent(); if ($this->quote->due_date != '' || $this->quote->client->getSetting('valid_until') == '') { } else { $this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until')); } $this->quote ->service() ->setStatus(Quote::STATUS_SENT) ->applyNumber() ->touchPdf() ->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; } }