bar = $bar; $this->api = $api; } public function handle(NamiUser $user): void { $this->bar->task('Synchronisiere Kurse', function() { $this->api->courses()->each(function($course) { Course::create(['nami_id' => $course->id, 'name' => $course->name]); }); }); } }