where('status', self::STATUS_NORMAL); } public function scopeAvailable($query) { return $query->where('status', 'in', [self::STATUS_NORMAL]); } public function user() { return $this->belongsTo(\app\admin\model\shopro\user\User::class, 'user_id', 'id'); } public function agentLevel() { return $this->belongsTo(Level::class, 'level', 'level'); } }