2019-05-02 21:07:38 +10:00
|
|
|
<?php
|
2019-05-11 13:32:07 +10:00
|
|
|
/**
|
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
|
*
|
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
|
*
|
2020-01-07 11:13:47 +11:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 13:32:07 +10:00
|
|
|
*
|
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
|
*/
|
2019-05-02 21:07:38 +10:00
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
2019-12-18 09:40:15 +11:00
|
|
|
use App\Factory\QuoteInvitationFactory;
|
2019-10-16 20:28:52 +11:00
|
|
|
use App\Helpers\Invoice\InvoiceSum;
|
2019-12-22 21:28:41 +11:00
|
|
|
use App\Jobs\Quote\ApplyQuoteNumber;
|
2019-12-18 09:40:15 +11:00
|
|
|
use App\Jobs\Quote\CreateQuoteInvitations;
|
2019-11-16 14:12:29 +11:00
|
|
|
use App\Models\Client;
|
2019-12-18 09:40:15 +11:00
|
|
|
use App\Models\ClientContact;
|
2019-05-02 21:07:38 +10:00
|
|
|
use App\Models\Quote;
|
2019-12-18 09:40:15 +11:00
|
|
|
use App\Models\QuoteInvitation;
|
2020-01-07 11:13:47 +11:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2019-05-02 21:07:38 +10:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* QuoteRepository
|
|
|
|
|
*/
|
|
|
|
|
class QuoteRepository extends BaseRepository
|
|
|
|
|
{
|
2020-01-07 11:13:47 +11:00
|
|
|
|
|
|
|
|
use MakesHash;
|
2020-02-12 09:21:06 +00:00
|
|
|
|
2019-05-02 21:07:38 +10:00
|
|
|
public function getClassName()
|
|
|
|
|
{
|
|
|
|
|
return Quote::class;
|
|
|
|
|
}
|
2020-02-12 09:21:06 +00:00
|
|
|
|
2019-12-31 08:59:12 +11:00
|
|
|
public function save($data, Quote $quote) : ?Quote
|
|
|
|
|
{
|
2020-02-26 22:21:12 +01:00
|
|
|
return $this->alternativeSave($data, $quote);
|
2019-12-31 08:59:12 +11:00
|
|
|
}
|
2020-02-20 07:44:12 +11:00
|
|
|
|
2020-02-24 21:15:30 +11:00
|
|
|
public function getInvitationByKey($key) :?QuoteInvitation
|
2020-02-20 07:44:12 +11:00
|
|
|
{
|
|
|
|
|
return QuoteInvitation::whereRaw("BINARY `key`= ?", [$key])->first();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-31 08:59:12 +11:00
|
|
|
}
|