2020-02-19 21:44:12 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* quote Ninja (https://quoteninja.com).
|
2020-02-19 21:44:12 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/quoteninja/quoteninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. quote Ninja LLC (https://quoteninja.com)
|
2020-02-19 21:44:12 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-02-19 21:44:12 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Factory;
|
|
|
|
|
2020-05-09 00:35:49 +02:00
|
|
|
use App\Models\Quote;
|
2020-02-19 21:44:12 +01:00
|
|
|
|
|
|
|
class CloneQuoteFactory
|
|
|
|
{
|
|
|
|
public static function create($quote, $user_id)
|
|
|
|
{
|
|
|
|
$clone_quote = $quote->replicate();
|
2020-05-09 00:35:49 +02:00
|
|
|
$clone_quote->status_id = Quote::STATUS_DRAFT;
|
2020-02-19 21:44:12 +01:00
|
|
|
$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;
|
2021-01-19 22:30:04 +01:00
|
|
|
//$clone_quote->balance = $quote->amount;
|
2020-02-19 21:44:12 +01:00
|
|
|
$clone_quote->amount = $quote->amount;
|
|
|
|
$clone_quote->line_items = $quote->line_items;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-02-19 21:44:12 +01:00
|
|
|
return $clone_quote;
|
|
|
|
}
|
|
|
|
}
|