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: class Identity extends Model
9: {
10: protected $table = 'mail_identities';
11:
12: protected $foreignModel = MailAccount::class;
13: protected $foreignModelIdColumn = 'IdAccount'; // Column that refers to an external table
14:
15: /**
16: * The attributes that are mass assignable.
17: *
18: * @var array
19: */
20: protected $fillable = [
21: 'Id',
22: 'IdUser',
23: 'IdAccount',
24: 'Default',
25: 'Email',
26: 'FriendlyName',
27: 'UseSignature',
28: 'Signature'
29: ];
30:
31: /**
32: * The attributes that should be hidden for arrays.
33: *
34: * @var array
35: */
36: protected $hidden = [
37: ];
38:
39: protected $casts = [
40: 'Default' => 'boolean',
41: 'UseSignature' => 'boolean',
42: 'Signature' => 'string'
43: ];
44:
45: protected $attributes = [
46: ];
47:
48: protected $appends = [
49: 'EntityId'
50: ];
51:
52: public function getEntityIdAttribute()
53: {
54: return $this->Id;
55: }
56:
57:
58: public function toResponseArray()
59: {
60: $aResponse = parent::toResponseArray();
61: $aResponse['EntityId'] = $this->Id;
62:
63: return $aResponse;
64: }
65: }
66: