CRUDの選択式のデータをデータベースに追加したい

実現したいこと

ここに実現したいことを箇条書きで書いてください。

性別 ※ 女性 男性

↑入力するタイプのデータは送信できますが、上記のような選択するタイプだと入力できません。

public function up()
{
Schema::create('contacts', function (Blueprint $table) {
$table->id();
$table->string('fullname');
$table->tinyInteger('gender')->unsigned()->comment('性別 0:男、1:女');
$table->string('email');
$table->char('postcode', 8);
$table->string('address');
$table->string('building_name')->nullable();
$table->text('opinion');
$table->timestamps();
});
}

マイグレーションファイルはこんな感じです。
テーブルのフィールド名genderのところに男性(0), 女性(1)を意味するvalueの送信はこれであってますでしょうか?

コメントを投稿

0 コメント