mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://opensource.org/licenses/AAL
|
|
*/
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Helpers\Invoice\InvoiceSum;
|
|
use App\Models\RecurringInvoice;
|
|
use App\Models\RecurringInvoiceInvitation;
|
|
|
|
/**
|
|
* RecurringInvoiceRepository.
|
|
*/
|
|
class RecurringInvoiceRepository extends BaseRepository
|
|
{
|
|
public function save($data, RecurringInvoice $invoice) : ?RecurringInvoice
|
|
{
|
|
|
|
$invoice = $this->alternativeSave($data, $invoice);
|
|
// $invoice->fill($data);
|
|
|
|
// $invoice->save();
|
|
|
|
// $invoice_calc = new InvoiceSum($invoice);
|
|
|
|
// $invoice->service()
|
|
// ->applyNumber()
|
|
// ->createInvitations()
|
|
// ->save();
|
|
|
|
// $invoice = $invoice_calc->build()->getRecurringInvoice();
|
|
|
|
return $invoice;
|
|
}
|
|
|
|
public function getInvitationByKey($key) :?RecurringInvoiceInvitation
|
|
{
|
|
return RecurringInvoiceInvitation::whereRaw('BINARY `key`= ?', [$key])->first();
|
|
}
|
|
}
|