'integer', 'auth_status' => 'integer', ]; const STATUS_OK = 1; const STATUS_PAUSE = 0; public static $statusMaps = [ self::STATUS_OK => '正常', self::STATUS_PAUSE => '暂停' ]; const TYPE_STUDENT = 0; const TYPE_TEACHER = 1; public static $typeMaps = [ self::TYPE_STUDENT => '学生', self::TYPE_TEACHER => '老师' ]; const AUTH_STATUS_WAIT = 0; const AUTH_STATUS_OK = 1; const AUTH_STATUS_NO = 2; public static $authStatusMaps = [ self::AUTH_STATUS_WAIT => '待认证', self::AUTH_STATUS_OK => '认证成功', self::AUTH_STATUS_NO => '认证失败', ]; protected $guarded = []; public function user() { return $this->belongsTo(User::class); } public function getAuthStatusTextAttribute() { return self::$authStatusMaps[$this->attributes['auth_status']]; } public function getTypeTextAttribute() { return self::$typeMaps[$this->attributes['type']]; } public function resource() { return $this->hasOne(Upload::class, 'id', 'imgs'); } }