mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
35 lines
918 B
PHP
35 lines
918 B
PHP
|
<?php
|
||
|
/**
|
||
|
* quote Ninja (https://quoteninja.com)
|
||
|
*
|
||
|
* @link https://github.com/quoteninja/quoteninja source repository
|
||
|
*
|
||
|
* @copyright Copyright (c) 2020. quote Ninja LLC (https://quoteninja.com)
|
||
|
*
|
||
|
* @license https://opensource.org/licenses/AAL
|
||
|
*/
|
||
|
|
||
|
namespace App\Factory;
|
||
|
|
||
|
use App\Models\quote;
|
||
|
|
||
|
class CloneQuoteFactory
|
||
|
{
|
||
|
public static function create($quote, $user_id)
|
||
|
{
|
||
|
$clone_quote = $quote->replicate();
|
||
|
$clone_quote->status_id = quote::STATUS_DRAFT;
|
||
|
$clone_quote->number = null;
|
||
|
$clone_quote->date = null;
|
||
|
$clone_quote->due_date = null;
|
||
|
$clone_quote->partial_due_date = null;
|
||
|
$clone_quote->user_id = $user_id;
|
||
|
$clone_quote->balance = $quote->amount;
|
||
|
$clone_quote->amount = $quote->amount;
|
||
|
$clone_quote->line_items = $quote->line_items;
|
||
|
$clone_quote->backup = null;
|
||
|
|
||
|
return $clone_quote;
|
||
|
}
|
||
|
}
|