Yeelight /
cloud2
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Yeelight\Models; |
||
| 4 | |||
| 5 | use Yeelight\Base\Models\BaseModel as Model; |
||
| 6 | use Yeelight\Models\Foundation\User; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class BaseModel |
||
| 10 | * |
||
| 11 | * @category Yeelight |
||
| 12 | * |
||
| 13 | * @package Yeelight\Models |
||
| 14 | * |
||
| 15 | * @author Sheldon Lee <[email protected]> |
||
| 16 | * |
||
| 17 | * @license https://opensource.org/licenses/MIT MIT |
||
| 18 | * |
||
| 19 | * @link https://www.yeelight.com |
||
| 20 | * |
||
| 21 | * @property-read mixed $id |
||
| 22 | * @mixin \Eloquent |
||
| 23 | */ |
||
| 24 | class BaseModel extends Model |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * 模型标记. |
||
| 28 | * |
||
| 29 | * @var |
||
| 30 | */ |
||
| 31 | public $modelTag; |
||
| 32 | |||
| 33 | public function __construct(array $attributes = []) |
||
| 34 | { |
||
| 35 | parent::__construct($attributes); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function initModelTag() |
||
| 39 | { |
||
| 40 | $this->modelTag = strtolower((new \ReflectionClass($this))->getShortName()); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return User|null |
||
| 45 | */ |
||
| 46 | public function getUser() |
||
| 47 | { |
||
| 48 | return parent::getUser(); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return User|null |
||
| 53 | */ |
||
| 54 | public function getAuthUser() |
||
| 55 | { |
||
| 56 | return parent::getAuthUser(); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return User|null |
||
| 61 | */ |
||
| 62 | public function getRelatedUser() |
||
| 63 | { |
||
| 64 | return $this->related_user; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 65 | } |
||
| 66 | } |
||
| 67 |