mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
* Fixes for datatables * Implement a BaseModel * Working on reusable header data model * Working on adding session variables * Clean up header data * Random Data Seeder * working on searching datatables across relationships. * Working on transforming primary keys between client and server facinglogic * Updated assets
35 lines
655 B
PHP
35 lines
655 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Laracasts\Presenter\PresentableTrait;
|
|
|
|
class Client extends BaseModel
|
|
{
|
|
use PresentableTrait;
|
|
|
|
protected $presenter = 'App\Models\Presenters\ClientPresenter';
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|