2015-03-18 00:39:03 +01:00
|
|
|
<?php namespace App\Models;
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-03-31 20:50:58 +02:00
|
|
|
use HTML;
|
|
|
|
|
2015-03-31 11:38:24 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
class Contact extends EntityModel
|
|
|
|
{
|
2015-03-31 11:38:24 +02:00
|
|
|
use SoftDeletes;
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
public static $fieldFirstName = 'Contact - First Name';
|
|
|
|
public static $fieldLastName = 'Contact - Last Name';
|
|
|
|
public static $fieldEmail = 'Contact - Email';
|
|
|
|
public static $fieldPhone = 'Contact - Phone';
|
|
|
|
|
|
|
|
public function client()
|
|
|
|
{
|
2015-03-31 11:38:24 +02:00
|
|
|
return $this->belongsTo('App\Models\Client');
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getPersonType()
|
|
|
|
{
|
|
|
|
return PERSON_CONTACT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
public function getLastLogin()
|
|
|
|
{
|
|
|
|
if ($this->last_login == '0000-00-00 00:00:00')
|
|
|
|
{
|
|
|
|
return '---';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $this->last_login->format('m/d/y h:i a');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function getDisplayName()
|
|
|
|
{
|
|
|
|
if ($this->getFullName()) {
|
|
|
|
return $this->getFullName();
|
|
|
|
} else {
|
|
|
|
return $this->email;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFullName()
|
|
|
|
{
|
|
|
|
if ($this->first_name || $this->last_name) {
|
|
|
|
return $this->first_name.' '.$this->last_name;
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|