where('status', self::STATUS_NORMAL); } public function scopeAvailable($query) { return $query->where('status', 'in', [self::STATUS_NORMAL]); } public function user() { return $this->belongsTo(\addons\shopro\model\User::class, 'user_id', 'id'); } public function agentLevel() { return $this->belongsTo(Level::class, 'level', 'level'); } public static function findByArea($areaId, $areaLevel) { return self::available() ->where('area_id', $areaId) ->where('area_level', $areaLevel) ->find(); } }