Fixes for contact API

This commit is contained in:
Hillel Coren 2017-03-27 11:43:47 +03:00
parent ddc9df6650
commit f96c0387a2
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?php
namespace App\Policies;
class ContactPolicy extends EntityPolicy
{
}

View File

@ -0,0 +1,51 @@
<?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);
}
}

View File

@ -59,6 +59,8 @@ If you require contacts to enter a password to see their invoice you'll need to
You can install PhantomJS to generate the PDF locally, to enable it add ``PHANTOMJS_BIN_PATH=/usr/local/bin/phantomjs``.
We suggest using version >= 2.1.1, users have reported seeing 'Error: 0' with older versions.
.. TIP:: To determine the path you can run ``which phantomjs`` from the command line.
Custom Fonts