2020-01-03 10:34:10 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-01-03 10:34:10 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-01-03 10:34:10 +01:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
|
|
use App\Models\Credit;
|
2020-01-07 01:13:47 +01:00
|
|
|
use App\Models\CreditInvitation;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
2020-01-03 10:34:10 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* CreditRepository.
|
2020-01-03 10:34:10 +01:00
|
|
|
*/
|
|
|
|
class CreditRepository extends BaseRepository
|
|
|
|
{
|
2020-01-07 01:13:47 +01:00
|
|
|
use MakesHash;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-01-03 10:34:10 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Saves the client and its contacts.
|
2020-01-03 10:34:10 +01:00
|
|
|
*
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param array $data The data
|
|
|
|
* @param Credit $credit
|
|
|
|
* @return Credit|Credit|null Credit Object
|
|
|
|
* @throws \ReflectionException
|
2020-01-03 10:34:10 +01:00
|
|
|
*/
|
2020-02-25 09:33:53 +01:00
|
|
|
public function save(array $data, Credit $credit) : ?Credit
|
2020-01-03 10:34:10 +01:00
|
|
|
{
|
2020-02-26 22:21:12 +01:00
|
|
|
return $this->alternativeSave($data, $credit);
|
2020-02-25 09:33:53 +01:00
|
|
|
}
|
2020-01-07 01:13:47 +01:00
|
|
|
|
2020-02-25 09:33:53 +01:00
|
|
|
public function getInvitationByKey($key) :?CreditInvitation
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
return CreditInvitation::whereRaw('BINARY `key`= ?', [$key])->first();
|
2020-01-03 10:34:10 +01:00
|
|
|
}
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|