1: | <?php |
2: | |
3: | namespace Aurora\Modules\Mail\Models; |
4: | |
5: | use Aurora\System\Classes\Model; |
6: | use Aurora\Modules\Mail\Models\MailAccount; |
7: | |
8: | /** |
9: | * Aurora\Modules\Mail\Models\Identity |
10: | * |
11: | * @property integer $Id |
12: | * @property integer $IdUser |
13: | * @property integer $IdAccount |
14: | * @property boolean $Default |
15: | * @property string $Email |
16: | * @property string $FriendlyName |
17: | * @property boolean $UseSignature |
18: | * @property string|null $Signature |
19: | * @property \Illuminate\Support\Carbon|null $CreatedAt |
20: | * @property \Illuminate\Support\Carbon|null $UpdatedAt |
21: | * @property-read mixed $entity_id |
22: | * @method static int count(string $columns = '*') |
23: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity find(int|string $id, array|string $columns = ['*']) |
24: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity findOrFail(int|string $id, mixed $id, Closure|array|string $columns = ['*'], Closure $callback = null) |
25: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity first(array|string $columns = ['*']) |
26: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity firstWhere(Closure|string|array|\Illuminate\Database\Query\Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and') |
27: | * @method static \Illuminate\Database\Eloquent\Builder|Identity newModelQuery() |
28: | * @method static \Illuminate\Database\Eloquent\Builder|Identity newQuery() |
29: | * @method static \Illuminate\Database\Eloquent\Builder|Identity query() |
30: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity where(Closure|string|array|\Illuminate\Database\Query\Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and') |
31: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereCreatedAt($value) |
32: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereDefault($value) |
33: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereEmail($value) |
34: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereFriendlyName($value) |
35: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereId($value) |
36: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereIdAccount($value) |
37: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereIdUser($value) |
38: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Mail\Models\Identity whereIn(string $column, mixed $values, string $boolean = 'and', bool $not = false) |
39: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereSignature($value) |
40: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereUpdatedAt($value) |
41: | * @method static \Illuminate\Database\Eloquent\Builder|Identity whereUseSignature($value) |
42: | * @mixin \Eloquent |
43: | */ |
44: | class Identity extends Model |
45: | { |
46: | protected $table = 'mail_identities'; |
47: | |
48: | protected $foreignModel = MailAccount::class; |
49: | protected $foreignModelIdColumn = 'IdAccount'; // Column that refers to an external table |
50: | |
51: | /** |
52: | * The attributes that are mass assignable. |
53: | * |
54: | * @var array |
55: | */ |
56: | protected $fillable = [ |
57: | 'Id', |
58: | 'IdUser', |
59: | 'IdAccount', |
60: | 'Default', |
61: | 'Email', |
62: | 'FriendlyName', |
63: | 'UseSignature', |
64: | 'Signature' |
65: | ]; |
66: | |
67: | /** |
68: | * The attributes that should be hidden for arrays. |
69: | * |
70: | * @var array |
71: | */ |
72: | protected $hidden = [ |
73: | ]; |
74: | |
75: | protected $casts = [ |
76: | 'Default' => 'boolean', |
77: | 'UseSignature' => 'boolean', |
78: | 'Signature' => 'string' |
79: | ]; |
80: | |
81: | protected $attributes = [ |
82: | ]; |
83: | |
84: | protected $appends = [ |
85: | 'EntityId' |
86: | ]; |
87: | |
88: | public function getEntityIdAttribute() |
89: | { |
90: | return $this->Id; |
91: | } |
92: | |
93: | |
94: | public function toResponseArray() |
95: | { |
96: | $aResponse = parent::toResponseArray(); |
97: | $aResponse['EntityId'] = $this->Id; |
98: | |
99: | return $aResponse; |
100: | } |
101: | } |
102: |