1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Cortex\Contacts\Models; |
6
|
|
|
|
7
|
|
|
use Rinvex\Tenants\Traits\Tenantable; |
8
|
|
|
use Spatie\Activitylog\Traits\LogsActivity; |
9
|
|
|
use Rinvex\Contacts\Models\Contact as BaseContact; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Cortex\Contacts\Models\Contact. |
13
|
|
|
* |
14
|
|
|
* @property int $id |
15
|
|
|
* @property int $entity_id |
16
|
|
|
* @property string $entity_type |
17
|
|
|
* @property string $source |
18
|
|
|
* @property string $method |
19
|
|
|
* @property string $name_prefix |
20
|
|
|
* @property string $first_name |
21
|
|
|
* @property string $middle_name |
22
|
|
|
* @property string $last_name |
23
|
|
|
* @property string $name_suffix |
24
|
|
|
* @property string $job_title |
25
|
|
|
* @property string $email |
26
|
|
|
* @property string $phone |
27
|
|
|
* @property string $fax |
28
|
|
|
* @property string $skype |
29
|
|
|
* @property string $twitter |
30
|
|
|
* @property string $facebook |
31
|
|
|
* @property string $google_plus |
32
|
|
|
* @property string $linkedin |
33
|
|
|
* @property string $country_code |
34
|
|
|
* @property string $language_code |
35
|
|
|
* @property string $birthday |
36
|
|
|
* @property string $gender |
37
|
|
|
* @property \Carbon\Carbon $created_at |
38
|
|
|
* @property \Carbon\Carbon $updated_at |
39
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Cortex\Foundation\Models\Log[] $activity |
40
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Rinvex\Contacts\Models\Contact[] $backRelatives |
41
|
|
|
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $entity |
42
|
|
|
* @property-read string $name |
43
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Rinvex\Contacts\Models\Contact[] $relatives |
44
|
|
|
* |
45
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Contacts\Models\Contact country($countryCode) |
46
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Contacts\Models\Contact language($languageCode) |
47
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Contacts\Models\Contact method($method) |
48
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Contacts\Models\Contact source($source) |
49
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereBirthday($value) |
50
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereCountryCode($value) |
51
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereCreatedAt($value) |
52
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereEmail($value) |
53
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereEntityId($value) |
54
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereEntityType($value) |
55
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereFacebook($value) |
56
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereFax($value) |
57
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereFirstName($value) |
58
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereGender($value) |
59
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereGooglePlus($value) |
60
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereId($value) |
61
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereJobTitle($value) |
62
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereLanguageCode($value) |
63
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereLastName($value) |
64
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereLinkedin($value) |
65
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereMethod($value) |
66
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereMiddleName($value) |
67
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereNamePrefix($value) |
68
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereNameSuffix($value) |
69
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact wherePhone($value) |
70
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereSkype($value) |
71
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereSource($value) |
72
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereTwitter($value) |
73
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Contacts\Models\Contact whereUpdatedAt($value) |
74
|
|
|
* @mixin \Eloquent |
75
|
|
|
*/ |
76
|
|
|
class Contact extends BaseContact |
77
|
|
|
{ |
78
|
|
|
use Tenantable; |
79
|
|
|
use LogsActivity; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Indicates whether to log only dirty attributes or all. |
83
|
|
|
* |
84
|
|
|
* @var bool |
85
|
|
|
*/ |
86
|
|
|
protected static $logOnlyDirty = true; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* The attributes that are logged on change. |
90
|
|
|
* |
91
|
|
|
* @var array |
92
|
|
|
*/ |
93
|
|
|
protected static $logAttributes = [ |
94
|
|
|
'entity_id', |
95
|
|
|
'entity_type', |
96
|
|
|
'source', |
97
|
|
|
'method', |
98
|
|
|
'name_prefix', |
99
|
|
|
'first_name', |
100
|
|
|
'middle_name', |
101
|
|
|
'last_name', |
102
|
|
|
'name_suffix', |
103
|
|
|
'job_title', |
104
|
|
|
'email', |
105
|
|
|
'phone', |
106
|
|
|
'fax', |
107
|
|
|
'skype', |
108
|
|
|
'twitter', |
109
|
|
|
'facebook', |
110
|
|
|
'google_plus', |
111
|
|
|
'linkedin', |
112
|
|
|
'country_code', |
113
|
|
|
'language_code', |
114
|
|
|
'birthday', |
115
|
|
|
'gender', |
116
|
|
|
]; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* The attributes that are ignored on change. |
120
|
|
|
* |
121
|
|
|
* @var array |
122
|
|
|
*/ |
123
|
|
|
protected static $ignoreChangedAttributes = [ |
|
|
|
|
124
|
|
|
'created_at', |
125
|
|
|
'updated_at', |
126
|
|
|
'deleted_at', |
127
|
|
|
]; |
128
|
|
|
} |
129
|
|
|
|
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.