2018-10-15 16:00:48 +11:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2018-11-02 21:54:46 +11:00
|
|
|
use Laracasts\Presenter\PresentableTrait;
|
2018-10-15 16:00:48 +11:00
|
|
|
|
2018-11-02 21:54:46 +11:00
|
|
|
class Client extends BaseModel
|
2018-10-15 16:00:48 +11:00
|
|
|
{
|
2018-11-02 21:54:46 +11:00
|
|
|
use PresentableTrait;
|
|
|
|
|
|
|
|
|
|
protected $presenter = 'App\Models\Presenters\ClientPresenter';
|
|
|
|
|
|
2018-10-29 14:16:17 +11:00
|
|
|
|
|
|
|
|
public function contacts()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(ClientContact::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function locations()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(ClientLocation::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function primary_location()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(ClientLocation::class)->whereIsPrimary(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function primary_contact()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(ClientContact::class)->whereIsPrimary(true);
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-15 16:00:48 +11:00
|
|
|
}
|