1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Services/Quote/ConvertQuote.php
Benjamin Beganović 7dd6f814ac
Change 'Quote' & 'Invoice' service implementation (#3327)
* Change '__invoke' to 'run' for Invoice services

*  Change '__invoke' to 'run' for Quote services
2020-02-14 14:32:22 +11:00

32 lines
693 B
PHP

<?php
namespace App\Services\Quote;
use App\Factory\CloneQuoteToInvoiceFactory;
use App\Quote;
use App\Repositories\InvoiceRepository;
class ConvertQuote
{
private $client;
private $invoice_repo;
public function __construct($client, InvoiceRepository $invoice_repo)
{
$this->client = $client;
$this->invoice_repo = $invoice_repo;
}
/**
* @param $quote
* @return mixed
*/
public function run($quote)
{
$invoice = CloneQuoteToInvoiceFactory::create($quote, $quote->user_id, $quote->company_id);
$this->invoice_repo->save([], $invoice);
// maybe should return invoice here
return $quote;
}
}