Add fee
This commit is contained in:
parent
2448a3df0b
commit
a785e839b2
14
src/Api.php
14
src/Api.php
|
@ -165,6 +165,12 @@ class Api {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function confessions(): Collection {
|
public function confessions(): Collection {
|
||||||
return collect($this->http()->get(self::$url."/ica/rest/baseadmin/konfession")['data'])->map(function($gender) {
|
return collect($this->http()->get(self::$url."/ica/rest/baseadmin/konfession")['data'])->map(function($gender) {
|
||||||
return Confession::fromNami($gender);
|
return Confession::fromNami($gender);
|
||||||
|
@ -209,14 +215,6 @@ class Api {
|
||||||
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
public function fees() {
|
|
||||||
$response = $this->client->get("/ica/rest/namiBeitrag/beitragsartmgl/gruppierung/{$this->user->getNamiGroupId()}", [
|
|
||||||
'cookies' => $this->cookie
|
|
||||||
]);
|
|
||||||
|
|
||||||
return json_decode((string)$response->getBody());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function regions() {
|
public function regions() {
|
||||||
$response = $this->client->get("/ica/rest/baseadmin/region", [
|
$response = $this->client->get("/ica/rest/baseadmin/region", [
|
||||||
'cookies' => $this->cookie
|
'cookies' => $this->cookie
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zoomyboy\LaravelNami;
|
||||||
|
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Fee extends Model {
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
public static function fromNami($item) {
|
||||||
|
$name = preg_replace('/DPSG Bundesverband 000000 \((.*?) - VERBANDSBEITRAG\)/', '\\1', $item['descriptor']);
|
||||||
|
|
||||||
|
return new self([
|
||||||
|
'name' => $name,
|
||||||
|
'id' => $item['id']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -28,6 +28,10 @@ class Group implements Arrayable {
|
||||||
return Nami::subgroupsOf($this->id);
|
return Nami::subgroupsOf($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fees() {
|
||||||
|
return Nami::feesOf($this->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function members(): MemberCollection {
|
public function members(): MemberCollection {
|
||||||
$members = Nami::membersOf($this->id);
|
$members = Nami::membersOf($this->id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue