1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Services/Quote/MarkSent.php
David Bomba 43e57d0117
Fixes for self-update (#3514)
* minor fix for payment notifications

* styleci

* Limit Self updating to self hosters only
:

* Fixes for designs

* Minor fixes for self-update
2020-03-21 16:37:30 +11:00

37 lines
725 B
PHP

<?php
namespace App\Services\Quote;
use App\Events\Quote\QuoteWasMarkedSent;
use App\Models\Quote;
class MarkSent
{
private $client;
private $quote;
public function __construct($client, $quote)
{
$this->client = $client;
$this->quote = $quote;
}
public function run()
{
/* Return immediately if status is not draft */
if ($this->quote->status_id != Quote::STATUS_DRAFT) {
return $quote;
}
$this->quote->markInvitationsSent();
event(new QuoteWasMarkedSent($this->quote, $this->quote->company));
$this->quote->service()->setStatus(Quote::STATUS_SENT)->applyNumber()->save();
return $this->quote;
}
}