Fixed: Push user to Initializer
This commit is contained in:
		
							parent
							
								
									697620896b
								
							
						
					
					
						commit
						86885b153d
					
				|  | @ -2,6 +2,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace App\Initialize; | namespace App\Initialize; | ||||||
| 
 | 
 | ||||||
|  | use Zoomyboy\LaravelNami\NamiUser; | ||||||
|  | 
 | ||||||
| class InitializeActivities { | class InitializeActivities { | ||||||
| 
 | 
 | ||||||
|     private $bar; |     private $bar; | ||||||
|  | @ -21,9 +23,9 @@ class InitializeActivities { | ||||||
|         $this->api = $api; |         $this->api = $api; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function handle() { |     public function handle(NamiUser $user) { | ||||||
|         $this->bar->task('Synchronisiere Tätigkeiten', function() { |         $this->bar->task('Synchronisiere Tätigkeiten', function() use ($user) { | ||||||
|             $this->api->activities(auth()->user()->getNamiGroupId())->each(function($activity) { |             $this->api->activities($user->getNamiGroupId())->each(function($activity) { | ||||||
|                 $activity =  \App\Activity::create([ |                 $activity =  \App\Activity::create([ | ||||||
|                     'nami_id' => $activity->id, |                     'nami_id' => $activity->id, | ||||||
|                     'name' => $activity->name, |                     'name' => $activity->name, | ||||||
|  |  | ||||||
|  | @ -2,6 +2,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace App\Initialize; | namespace App\Initialize; | ||||||
| 
 | 
 | ||||||
|  | use Zoomyboy\LaravelNami\NamiUser; | ||||||
|  | 
 | ||||||
| class InitializeFees { | class InitializeFees { | ||||||
| 
 | 
 | ||||||
|     private $bar; |     private $bar; | ||||||
|  | @ -12,9 +14,9 @@ class InitializeFees { | ||||||
|         $this->api = $api; |         $this->api = $api; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function handle() { |     public function handle(NamiUser $user) { | ||||||
|         $this->bar->task('Synchronisiere Beiträge', function() { |         $this->bar->task('Synchronisiere Beiträge', function() use ($user) { | ||||||
|             $this->api->feesOf(auth()->user()->getNamiGroupId())->each(function($fee) { |             $this->api->feesOf($user->getNamiGroupId())->each(function($fee) { | ||||||
|                 \App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name]) |                 \App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name]) | ||||||
|                     ->subscriptions()->create([ |                     ->subscriptions()->create([ | ||||||
|                         'name' => $fee->name, |                         'name' => $fee->name, | ||||||
|  |  | ||||||
|  | @ -2,6 +2,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace App\Initialize; | namespace App\Initialize; | ||||||
| 
 | 
 | ||||||
|  | use Zoomyboy\LaravelNami\NamiUser; | ||||||
|  | 
 | ||||||
| class InitializeGenders { | class InitializeGenders { | ||||||
| 
 | 
 | ||||||
|     private $bar; |     private $bar; | ||||||
|  | @ -12,7 +14,7 @@ class InitializeGenders { | ||||||
|         $this->api = $api; |         $this->api = $api; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function handle() { |     public function handle(NamiUser $user) { | ||||||
|         $this->bar->task('Synchronisiere Geschlechter', function() { |         $this->bar->task('Synchronisiere Geschlechter', function() { | ||||||
|             $this->api->genders()->each(function($gender) { |             $this->api->genders()->each(function($gender) { | ||||||
|                 \App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]); |                 \App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]); | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ class InitializeJob implements ShouldQueue | ||||||
|         $bar = $this->createProgressBar('Initialisiere'); |         $bar = $this->createProgressBar('Initialisiere'); | ||||||
| 
 | 
 | ||||||
|         foreach (static::$initializers as $initializer) { |         foreach (static::$initializers as $initializer) { | ||||||
|             (new $initializer($bar, $api))->handle(); |             (new $initializer($bar, $api))->handle($this->user); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $bar->finish('Initialisierung abgeschlossen'); |         $bar->finish('Initialisierung abgeschlossen'); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue