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