mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
* Add URL link directly to client view in list view * Implement Form requests for all client routes * Refactor how permissions are implemented on Datatable row action menus * fixes for tests * bug fix * Add ctrans global function for custom translations. Reduced DB queries for Client List. Added Debugbar for dev environments * ctrans
50 lines
992 B
PHP
50 lines
992 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',
|
|
'contacts',
|
|
'primary_contact',
|
|
'q'
|
|
];
|
|
|
|
protected $with = ['contacts', 'primary_contact'];
|
|
|
|
//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);
|
|
}
|
|
|
|
}
|