mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
52 lines
974 B
PHP
52 lines
974 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use App\Models\Client;
|
||
|
use App\Ninja\Repositories\ContactRepository;
|
||
|
|
||
|
/**
|
||
|
* Class ContactService.
|
||
|
*/
|
||
|
class ContactService extends BaseService
|
||
|
{
|
||
|
/**
|
||
|
* @var ContactRepository
|
||
|
*/
|
||
|
protected $contactRepo;
|
||
|
|
||
|
/**
|
||
|
* ContactService constructor.
|
||
|
*
|
||
|
* @param ContactRepository $contactRepo
|
||
|
*/
|
||
|
public function __construct(ContactRepository $contactRepo)
|
||
|
{
|
||
|
$this->contactRepo = $contactRepo;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return ContactRepository
|
||
|
*/
|
||
|
protected function getRepo()
|
||
|
{
|
||
|
return $this->contactRepo;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param $data
|
||
|
* @param null $contact
|
||
|
*
|
||
|
* @return mixed|null
|
||
|
*/
|
||
|
public function save($data, $contact = null)
|
||
|
{
|
||
|
if (isset($data['client_id']) && $data['client_id']) {
|
||
|
$data['client_id'] = Client::getPrivateId($data['client_id']);
|
||
|
}
|
||
|
|
||
|
return $this->contactRepo->save($data, $contact);
|
||
|
}
|
||
|
|
||
|
}
|