27 lines
		
	
	
		
			675 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			675 B
		
	
	
	
		
			PHP
		
	
	
	
| <?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() {
 | |
|             $this->api->group(auth()->user()->getNamiGroupId())->fees()->each(function($fee) {
 | |
|                 \App\Fee::create(['nami_id' => $fee->id, 'name' => $fee->name])
 | |
|                     ->subscriptions()->create([
 | |
|                         'name' => $fee->name,
 | |
|                         'amount' => 1000,
 | |
|                     ]);
 | |
|             });
 | |
|         });
 | |
|     }
 | |
| }
 |