adrema/app/Initialize/InitializeConfessions.php

24 lines
637 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App\Initialize;
class InitializeConfessions {
private $bar;
private $api;
public $nullName = 'ohne Konfession';
public function __construct($bar, $api) {
$this->bar = $bar;
$this->api = $api;
}
public function handle() {
$this->bar->task('Synchronisiere Konfessionen', function() {
collect($this->api->confessions()->data)->each(function($confession) {
\App\Confession::create(['nami_id' => $confession->id, 'name' => $confession->descriptor, 'is_null' => $this->nullName === $confession->descriptor]);
});
});
}
}