1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace Gewaer\Models; |
||
5 | |||
6 | use Gewaer\Traits\SubscriptionPlanLimitTrait; |
||
7 | |||
8 | class UsersInvite extends AbstractModel |
||
9 | { |
||
10 | use SubscriptionPlanLimitTrait; |
||
1 ignored issue
–
show
Bug
introduced
by
![]() |
|||
11 | |||
12 | /** |
||
13 | * |
||
14 | * @var integer |
||
15 | */ |
||
16 | public $id; |
||
17 | |||
18 | /** |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | public $invite_hash; |
||
23 | |||
24 | /** |
||
25 | * |
||
26 | * @var integer |
||
27 | */ |
||
28 | public $companies_id; |
||
29 | |||
30 | /** |
||
31 | * |
||
32 | * @var integer |
||
33 | */ |
||
34 | public $role_id; |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * @var integer |
||
39 | */ |
||
40 | public $app_id; |
||
41 | |||
42 | /** |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | public $email; |
||
47 | |||
48 | /** |
||
49 | * |
||
50 | * @var integer |
||
51 | */ |
||
52 | public $is_deleted; |
||
53 | |||
54 | /** |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | public $created_at; |
||
59 | |||
60 | /** |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | public $updated_at; |
||
65 | |||
66 | /** |
||
67 | * Subscription plan key |
||
68 | */ |
||
69 | protected $subscriptionPlanLimitKey = 'users'; |
||
70 | |||
71 | /** |
||
72 | * Initialize method for model. |
||
73 | */ |
||
74 | 4 | public function initialize() |
|
75 | { |
||
76 | 4 | $this->setSource('users_invite'); |
|
77 | |||
78 | 4 | $this->belongsTo( |
|
79 | 4 | 'companies_id', |
|
80 | 4 | 'Gewaer\Models\Companies', |
|
81 | 4 | 'id', |
|
82 | 4 | ['alias' => 'company'] |
|
83 | ); |
||
84 | |||
85 | 4 | $this->belongsTo( |
|
86 | 4 | 'apps_id', |
|
87 | 4 | 'Gewaer\Models\Apps', |
|
88 | 4 | 'id', |
|
89 | 4 | ['alias' => 'app'] |
|
90 | ); |
||
91 | 4 | } |
|
92 | |||
93 | /** |
||
94 | * Returns table name mapped in the model. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 4 | public function getSource(): string |
|
99 | { |
||
100 | 4 | return 'users_invite'; |
|
101 | } |
||
102 | |||
103 | /** |
||
104 | * What to do after the creation of a new users |
||
105 | * - Assign default role |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | 4 | public function afterCreate() |
|
110 | { |
||
111 | 4 | $this->updateAppActivityLimit(); |
|
112 | 4 | } |
|
113 | } |
||
114 |