Schema::create('frofiles', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id'); $table->string('name'); $table->string('birthday'); $table→integer('phone'); << 이컬럼에 010 0000 0000 을 입력하면 10 0000 0000 이렇게 데이터베이스에 나와요 $table->string('question'); $table->string('answer'); $table->timestamps(); });
이런식으로 마이그레이션을 했습니다, 다른 정보들을 입력이 잘되는데
phone 컬럼에 010 0000 0000 이런 데이터를 입력하고 데이터베이스 들어가서 확인해보면
10 0000 0000 이렇게 나옵니다 왜 앞에 0 이 빠지는 거죠 ?? ㅠㅠ 도움좀주세요
전화번호에는 010-1000-1111 같은 것도 있으니 string 으로 다루셔야 합니다. 그래야 regex로 validation하기도 좋구요.
전화번호 필드는 integer 로 하시면 문의하신 사항처럼 오류를 범하니
varchar 나 char 로 DB를 설정하셔야 합니다.
그리고 라라벨에서도 등록할떄 interger 가 아닌 string이나 다른 방법으로 등록하셔야 합니다.
Schema::create('frofiles', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->string('name');
$table->string('birthday');
$table→integer('phone'); << 이컬럼에 010 0000 0000 을 입력하면 10 0000 0000 이렇게 데이터베이스에 나와요
$table->string('question');
$table->string('answer');
$table->timestamps();
});
이런식으로 마이그레이션을 했습니다, 다른 정보들을 입력이 잘되는데
phone 컬럼에 010 0000 0000 이런 데이터를 입력하고 데이터베이스 들어가서 확인해보면
10 0000 0000 이렇게 나옵니다 왜 앞에 0 이 빠지는 거죠 ?? ㅠㅠ 도움좀주세요