fix: sync fees and nationalities
This commit is contained in:
parent
4c94ff4c3c
commit
205664611d
|
@ -6,6 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Fee extends Model
|
class Fee extends Model
|
||||||
{
|
{
|
||||||
public $fillable = ['title', 'nami_id'];
|
public $fillable = ['name', 'nami_id'];
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,8 @@ class InitializeFees {
|
||||||
|
|
||||||
public function handle() {
|
public function handle() {
|
||||||
$this->bar->task('Synchronisiere Beiträge', function() {
|
$this->bar->task('Synchronisiere Beiträge', function() {
|
||||||
collect($this->api->fees()->data)->each(function($fee) {
|
$this->api->group(auth()->user()->getNamiGroupId())->fees()->each(function($fee) {
|
||||||
$title = preg_replace('/^.*\((.*)\).*$/', '\\1', $fee->descriptor);
|
\App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name]);
|
||||||
\App\Fee::create(['nami_id' => $fee->id, 'title' => $title]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,9 @@ class InitializeNationalities {
|
||||||
|
|
||||||
public function handle() {
|
public function handle() {
|
||||||
$this->bar->task('Synchronisiere Nationalitäten', function() {
|
$this->bar->task('Synchronisiere Nationalitäten', function() {
|
||||||
collect($this->api->nationalities()->data)->each(function($nationality) {
|
$this->api->group(auth()->user()->getNamiGroupId())->fees();
|
||||||
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->descriptor]);
|
$this->api->nationalities()->each(function($nationality) {
|
||||||
|
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CreateFeesTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('fees', function (Blueprint $table) {
|
Schema::create('fees', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('title');
|
$table->string('name');
|
||||||
$table->integer('nami_id');
|
$table->integer('nami_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue