Remove default gender

This commit is contained in:
philipp lang 2021-04-11 17:02:49 +02:00
parent b350f51444
commit 0222fe4862
4 changed files with 3 additions and 9 deletions

View File

@ -6,9 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class Gender extends Model
{
public $fillable = ['name', 'is_null', 'nami_id'];
public $casts = [
'is_null' => 'boolean'
];
public $fillable = ['name', 'nami_id'];
}

View File

@ -6,7 +6,6 @@ class InitializeGenders {
private $bar;
private $api;
public $nullName = 'Keine Angabe';
public function __construct($bar, $api) {
$this->bar = $bar;
@ -16,7 +15,7 @@ class InitializeGenders {
public function handle() {
$this->bar->task('Synchronisiere Geschlechter', function() {
$this->api->genders()->each(function($gender) {
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name, 'is_null' => $gender->name === $this->nullName]);
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]);
});
});
}

View File

@ -27,7 +27,7 @@ class MemberController extends Controller
session()->put('title', 'Mitglied bearbeiten');
return \Inertia::render('member/Edit', [
'genders' => Gender::where('is_null', false)->get()->pluck('name', 'id'),
'genders' => Gender::get()->pluck('name', 'id'),
'countries' => Country::get()->pluck('name', 'id'),
'regions' => Region::where('is_null', false)->get()->pluck('name', 'id'),
'nationalities' => Nationality::get()->pluck('name', 'id'),

View File

@ -16,7 +16,6 @@ class CreateGendersTable extends Migration
Schema::create('genders', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('is_null');
$table->integer('nami_id');
$table->timestamps();
});