mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 06:24:35 -04:00
* 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
45 lines
843 B
PHP
45 lines
843 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'
|
|
];
|
|
|
|
public function getRouteKeyName()
|
|
{
|
|
return 'client_id';
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
}
|