Remove default gender
This commit is contained in:
parent
b350f51444
commit
0222fe4862
app
database/migrations
|
@ -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'];
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue