2020-04-12 00:26:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
|
|
|
class InitializeFees {
|
|
|
|
|
|
|
|
private $bar;
|
|
|
|
private $api;
|
|
|
|
|
|
|
|
public function __construct($bar, $api) {
|
|
|
|
$this->bar = $bar;
|
|
|
|
$this->api = $api;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handle() {
|
|
|
|
$this->bar->task('Synchronisiere Beiträge', function() {
|
2021-11-17 22:32:52 +01:00
|
|
|
$this->api->feesOf(auth()->user()->getNamiGroupId())->each(function($fee) {
|
2021-07-04 12:09:30 +02:00
|
|
|
\App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name])
|
|
|
|
->subscriptions()->create([
|
|
|
|
'name' => $fee->name,
|
|
|
|
'amount' => 1000,
|
|
|
|
]);
|
2020-04-12 00:26:44 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|