mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
659af63b5c
* Skip preview tests * Fixes for product test * Fixes for tests * Update README.md * Update README.md * Update README.md * Update README.md * Fixes for incorrect payment types * Refactor class nameS * Entity Notification refactor * Entity Notifications * Add Quotes to randomdataseederr
41 lines
787 B
PHP
41 lines
787 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 $this->quote;
|
|
}
|
|
|
|
$this->quote->markInvitationsSent();
|
|
|
|
event(new QuoteWasMarkedSent($this->quote, $this->quote->company));
|
|
|
|
$this->quote
|
|
->service()
|
|
->setStatus(Quote::STATUS_SENT)
|
|
->applyNumber()
|
|
->save();
|
|
|
|
return $this->quote;
|
|
}
|
|
}
|