fix: sync fees and nationalities

This commit is contained in:
philipp lang 2021-04-10 00:29:48 +02:00
parent 4c94ff4c3c
commit 205664611d
4 changed files with 8 additions and 8 deletions

View File

@ -6,6 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Fee extends Model
{
public $fillable = ['title', 'nami_id'];
public $fillable = ['name', 'nami_id'];
public $timestamps = false;
}

View File

@ -14,9 +14,8 @@ class InitializeFees {
public function handle() {
$this->bar->task('Synchronisiere Beiträge', function() {
collect($this->api->fees()->data)->each(function($fee) {
$title = preg_replace('/^.*\((.*)\).*$/', '\\1', $fee->descriptor);
\App\Fee::create(['nami_id' => $fee->id, 'title' => $title]);
$this->api->group(auth()->user()->getNamiGroupId())->fees()->each(function($fee) {
\App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name]);
});
});
}

View File

@ -14,8 +14,9 @@ class InitializeNationalities {
public function handle() {
$this->bar->task('Synchronisiere Nationalitäten', function() {
collect($this->api->nationalities()->data)->each(function($nationality) {
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->descriptor]);
$this->api->group(auth()->user()->getNamiGroupId())->fees();
$this->api->nationalities()->each(function($nationality) {
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
});
});
}

View File

@ -15,8 +15,8 @@ class CreateFeesTable extends Migration
{
Schema::create('fees', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->integer('nami_id');
$table->string('name');
$table->integer('nami_id');
});
}