Laravel数据库,我应该使用什么数据类型来存储护照号码?



我正在为一家旅行社开发客户注册页面。客户端需要将护照号作为记录保存在MySQL数据库中。我想知道在迁移页面中提到用于存储护照号码的理想数据类型。护照号码通常由一两个英文字母和几个数字组成。

Schema::create('clients', function (Blueprint $table) {
$table->id();
$table->string('surname');
$table->string('other_names')
$table->date('dob');
$table-> ?? ('ppt_no');

您应该在应用程序投入生产之前对它们进行加密。否则,您可能需要一个字母数字列,如CHAR(9)或VARCHAR(9)。

$table->string('passport_number', 9)->unique();

最新更新