1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Services/ContactService.php
2017-03-27 11:43:47 +03: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);
}
}