mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
348890e8fa
* View composers * Saving client and contacts * saving client and contacts * update client job * unique emails
45 lines
877 B
PHP
45 lines
877 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Laracasts\Presenter\PresentableTrait;
|
|
use Hashids\Hashids;
|
|
use App\Utils\Traits\MakesHash;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Client extends BaseModel
|
|
{
|
|
use PresentableTrait;
|
|
use MakesHash;
|
|
use SoftDeletes;
|
|
|
|
protected $presenter = 'App\Models\Presenters\ClientPresenter';
|
|
|
|
//protected $appends = ['client_id'];
|
|
|
|
protected $guarded = [
|
|
'id',
|
|
'updated_at',
|
|
'created_at',
|
|
'deleted_at',
|
|
];
|
|
|
|
//protected $dates = ['deleted_at'];
|
|
|
|
public function getHashedIdAttribute()
|
|
{
|
|
return $this->encodePrimaryKey($this->id);
|
|
}
|
|
|
|
public function contacts()
|
|
{
|
|
return $this->hasMany(ClientContact::class);
|
|
}
|
|
|
|
public function primary_contact()
|
|
{
|
|
return $this->hasMany(ClientContact::class)->whereIsPrimary(true);
|
|
}
|
|
|
|
}
|