mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
fa83ce10a3
* Add contact * Saving client and contacts * working on ts implementation * Need to pass into TS * client_edit.ts * Need to pass into TS * declare variables
56 lines
1.0 KiB
PHP
56 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 = [
|
|
'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);
|
|
}
|
|
|
|
}
|