Skip to content

Instantly share code, notes, and snippets.

@FranklysG
Created September 23, 2022 13:14
Show Gist options
  • Save FranklysG/d78643fa42896cae96ada1a5c14d40d1 to your computer and use it in GitHub Desktop.
Save FranklysG/d78643fa42896cae96ada1a5c14d40d1 to your computer and use it in GitHub Desktop.
public function __invoke()
{
try {
$this->provinsi = collect(json_decode((new Client())->get("{$this->url}getwilayah")->getBody()->getContents(), true));
$this->requests($this->provinsi, 'kabupaten');
$this->requests($this->kabupaten, 'kecamatan');
$this->requests($this->kecamatan, 'desa');
return response($this->desa);
} catch (ClientException $e) {
report($e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment