1 | <?php |
||
26 | class MemberLimit extends BaseBlameableModel |
||
27 | { |
||
28 | public $contentAttribute = 'limit'; |
||
29 | public $contentAttributeRule = ['integer', 'min' => 0]; |
||
30 | public $createdByAttribute = 'organization_guid'; |
||
31 | public $updatedByAttribute = false; |
||
32 | public $idAttribute = false; |
||
33 | /** |
||
34 | * @var string The host who owns this model. |
||
35 | * Note: Please assign it with your own Organization model. |
||
36 | */ |
||
37 | public $hostClass = Organization::class; |
||
38 | public $defaultLimit = 100; |
||
39 | |||
40 | 50 | public static function tableName() |
|
44 | |||
45 | 50 | protected function getLimitRules() |
|
46 | { |
||
47 | return [ |
||
48 | 50 | [$this->contentAttribute, 'default', 'value' => is_numeric($this->defaultLimit) ? (int)$this->defaultLimit : 100] |
|
49 | 50 | ]; |
|
50 | } |
||
51 | |||
52 | 50 | public function rules() |
|
56 | |||
57 | public function attributeLabels() |
||
69 | |||
70 | /** |
||
71 | * Get the upper limit of members. |
||
72 | * @param $organization |
||
73 | * @return int|boolean |
||
74 | */ |
||
75 | 50 | public static function getLimit($organization) |
|
94 | } |
||
95 |