invoiceninja/app/Models/ClientContact.php
David Bomba 0f66625cdf
Refactor clients (#2513)
* attempting to bind vue to blade partials

* typo for vue

* working on client contact page

* refactor shipping-billing addresses back to client model

* clean up
2018-11-21 19:28:07 +11:00

57 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use App\Utils\Traits\MakesHash;
use Hashids\Hashids;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laracasts\Presenter\PresentableTrait;
class ClientContact extends Authenticatable
{
use Notifiable;
use MakesHash;
use PresentableTrait;
// protected $appends = ['contact_id'];
protected $guard = 'contact';
protected $presenter = 'App\Models\Presenters\ClientContactPresenter';
protected $guarded = [
'id',
];
protected $hidden = [
'id',
'password',
'remember_token',
];
public function getRouteKeyName()
{
return 'contact_id';
}
public function getContactIdAttribute()
{
return $this->encodePrimaryKey($this->id);
}
public function client()
{
$this->hasOne(Client::class);
}
public function primary_contact()
{
$this->where('is_primary', true);
}
}