adrema/app/Initialize/InitializeConfessions.php

22 lines
482 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App\Initialize;
2022-01-03 01:17:24 +01:00
use App\Confession;
2020-04-12 00:26:44 +02:00
class InitializeConfessions {
private $api;
public $nullName = 'ohne Konfession';
2022-01-03 01:17:24 +01:00
public function __construct($api) {
2020-04-12 00:26:44 +02:00
$this->api = $api;
}
public function handle() {
2022-01-03 01:17:24 +01:00
$this->api->confessions()->each(function($confession) {
Confession::create(['nami_id' => $confession->id, 'name' => $confession->name, 'is_null' => $this->nullName === $confession->name]);
2020-04-12 00:26:44 +02:00
});
}
}