bakaphp /
phalcon-api
| 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; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 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 $company_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 | 3 | public function initialize() |
|
| 75 | { |
||
| 76 | 3 | $this->setSource('users_invite'); |
|
| 77 | |||
| 78 | 3 | $this->belongsTo( |
|
| 79 | 3 | 'company_id', |
|
| 80 | 3 | 'Gewaer\Models\Companies', |
|
| 81 | 3 | 'id', |
|
| 82 | 3 | ['alias' => 'company'] |
|
| 83 | ); |
||
| 84 | |||
| 85 | 3 | $this->belongsTo( |
|
| 86 | 3 | 'apps_id', |
|
| 87 | 3 | 'Gewaer\Models\Apps', |
|
| 88 | 3 | 'id', |
|
| 89 | 3 | ['alias' => 'app'] |
|
| 90 | ); |
||
| 91 | 3 | } |
|
| 92 | |||
| 93 | /** |
||
| 94 | * Returns table name mapped in the model. |
||
| 95 | * |
||
| 96 | * @return string |
||
| 97 | */ |
||
| 98 | 3 | public function getSource(): string |
|
| 99 | { |
||
| 100 | 3 | 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 | 3 | public function afterCreate() |
|
| 110 | { |
||
| 111 | 3 | $this->updateAppActivityLimit(); |
|
| 112 | 3 | } |
|
| 113 | } |
||
| 114 |