【问题标题】:Laravel database, what data type should I use to store a passport number?Laravel 数据库,我应该使用什么数据类型来存储护照号码?
【发布时间】:2021-10-02 16:11:22
【问题描述】:

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

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

【问题讨论】:

  • 您是打算只存储护照号码还是要对其进行加密?
  • 暂时只存储护照号码

标签: php mysql laravel laravel-8 laravel-migrations


【解决方案1】:

您真的应该在应用程序投入生产之前encrypt 他们。否则,您可能需要一个字母数字列,例如 CHAR(9) 或 VARCHAR(9)。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-09
    • 1970-01-01
    • 2011-06-06
    • 1970-01-01
    • 2011-07-24
    相关资源
    最近更新 更多