mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
17a7f0564e
* Fix for comparing delete contacts change diffKeys to diff() * Client create * Create client * Create client
60 lines
1.1 KiB
PHP
60 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
use Hashids\Hashids;
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
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;
|
|
use SoftDeletes;
|
|
|
|
// protected $appends = ['contact_id'];
|
|
|
|
protected $guard = 'contact';
|
|
|
|
protected $presenter = 'App\Models\Presenters\ClientContactPresenter';
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
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);
|
|
}
|
|
|
|
}
|