Add region Api
This commit is contained in:
parent
c8537d0037
commit
1825950eb1
15
src/Api.php
15
src/Api.php
|
@ -171,6 +171,13 @@ class Api {
|
|||
});
|
||||
}
|
||||
|
||||
public function regions() {
|
||||
return collect($this->http()->get(self::$url."/ica/rest/baseadmin/region")['data'])->map(function($region) {
|
||||
return Region::fromNami($region);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function feesOf($groupid) {
|
||||
return collect($this->http()->get(self::$url."/ica/rest/namiBeitrag/beitragsartmgl/gruppierung/{$groupid}")['data'])->map(function($fee) {
|
||||
return Fee::fromNami($fee);
|
||||
|
@ -221,14 +228,6 @@ class Api {
|
|||
|
||||
// -------------------------------------
|
||||
|
||||
public function regions() {
|
||||
$response = $this->client->get("/ica/rest/baseadmin/region", [
|
||||
'cookies' => $this->cookie
|
||||
]);
|
||||
|
||||
return json_decode((string)$response->getBody());
|
||||
}
|
||||
|
||||
public function groupForActivity($activityId) {
|
||||
|
||||
$response = $this->client->get("/ica/rest//nami/untergliederungauftaetigkeit/filtered/untergliederung/taetigkeit/{$activityId}", [
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Zoomyboy\LaravelNami;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Region extends Model {
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public static function fromNami($item) {
|
||||
return new self([
|
||||
'id' => $item['id'],
|
||||
'name' => preg_replace('/\s*\(.*?\)/', '', $item['descriptor'])
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue