1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
invoiceninja/app/Services/ContactService.php
2019-01-30 22:25:37 +11:00

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);
}
}