【问题标题】:Laravel Php artisan migrate ErrorLaravel Php工匠迁移错误
【发布时间】:2017-11-29 04:01:11
【问题描述】:

我需要将我的新项目连接到我之前使用的旧数据库中。这是必须的。这样我就创建了数据模型

attendance.php

class attendance extends Model
{
     protected $table = "attendance";
     protected $fillable = ['id',

    'trainee_id',
    'name',
    'time'
    ];
}

然后迁移称为 create_attendance_table

Schema::create('attendance', function (Blueprint $table) {
            $table->increments('id');
            $table->string('trainee_id');
            $table->strind('name');
            $table->string('time');
            $table->rememberToken();
            $table->timestamps();
        });

还有.env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:aMklPOtN0cQEm2OiaeFpBaw75ghPLTxvj8Yx7PrQ8Gc=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Training_Management
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

这是我遇到的错误。

【问题讨论】:

  • 如果您的问题已经解决,请关闭问题

标签: php database laravel laravel-5 database-migration


【解决方案1】:

迁移文件中有语法错误。

所以,改变

        $table->strind('name');

        $table->string('name');

【讨论】:

  • 非常感谢
【解决方案2】:

在你的迁移文件 create_attendance_table 你需要改变

$table->strind('name');

$table->string('name');

【讨论】:

    【解决方案3】:

    $table->strind('name'); 更改为$table->string('name');

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-01
      • 2017-11-29
      • 2018-12-02
      • 1970-01-01
      • 2017-06-20
      • 2016-06-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多