UniAccountUser.php 833 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 04/03/2017
  6. * Time: 14:16
  7. */
  8. namespace app\common\models\user;
  9. use app\common\models\BaseModel;
  10. class UniAccountUser extends BaseModel
  11. {
  12. public $table = 'uni_account_users';
  13. public $timestamps = false;
  14. protected $guarded = [''];
  15. protected $attributes = [
  16. 'rank' => 0
  17. ];
  18. public function __construct()
  19. {
  20. if (config('app.framework') == 'platform') {
  21. $this->table = 'yz_app_user';
  22. $this->timestamps = true;
  23. }
  24. }
  25. public function hasUser()
  26. {
  27. return $this->hasMany('app\common\models\user\User', 'uid', 'uid');
  28. }
  29. public function hasRole()
  30. {
  31. return $this->hasOne('app\common\models\user\YzUserRole', 'user_id', 'uid');
  32. }
  33. }