123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Model;
- class Drug extends ModelAbstract
- {
- public $id;
- public $name;
- public $group;
- public function __construct(string $name, string $group, int $id = null)
- {
- $this->name = $name;
- $this->group = $group;
- $this->id = $id;
- }
- public function validate(): bool
- {
- if (iconv_strlen($this->name) > 50 || iconv_strlen($this->name) < 2) {
- return false;
- }
- if (iconv_strlen($this->group) > 50 || iconv_strlen($this->group) < 2) {
- return false;
- }
- return true;
- }
- }
|