fix: sync fees and nationalities
This commit is contained in:
parent
4c94ff4c3c
commit
205664611d
app
database/migrations
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue