column['lat'] = (string) $column; $this->column['lng'] = (string) $arguments[0]; array_shift($arguments); $this->label = $this->formatLabel($arguments); /* * Google map is blocked in mainland China * people in China can use Tencent map instead(; */ switch (static::getUsingMap()) { case 'tencent': $this->tencent(); break; case 'google': $this->google(); break; case 'yandex': $this->yandex(); break; case 'amap': $this->amap(); break; case 'baidu': default: $this->baidu(); } } public function height(string $height) { $this->height = $height; return $this; } protected static function getUsingMap() { return config('admin.map.provider') ?: config('admin.map_provider'); } public function google() { return $this->addVariables(['type' => 'google']); } public function tencent() { return $this->addVariables(['type' => 'tencent']); } public function yandex() { return $this->addVariables(['type' => 'yandex']); } public function baidu() { return $this->addVariables(['type' => 'baidu', 'searchId' => 'bdmap'.Str::random()]); } public function amap() { return $this->addVariables(['type' => 'amap', 'searchId' => 'amap'.Str::random()]); } protected function getDefaultElementClass() { $class = $this->normalizeElementClass($this->column['lat']).$this->normalizeElementClass($this->column['lng']); return [$class, static::NORMAL_CLASS]; } public function render() { $this->addVariables(['height' => $this->height]); return parent::render(); } }