我正在使用 Laravel 5.4 开发学校管理系统。当我迁移数据库表时,我收到此错误消息:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '100' (T_LNUMBER), expecting ',' or ')'
请帮助我,我该如何解决这个错误?
迁移:
public function up() {
Schema::create('students', function (Blueprint $table) {
$table->increments('student_id'); $table->string('first_name',50); $table->string('last_name',50); $table->date('dob');
$table->string('100')->nullable(); $table->string('status');
$table->string('current_address',255)->nullable();
$table->foreign('user_id')->references('user_id')->on('users');
//$table->timestamps();
}); }
最佳答案
这是不允许的:
$table->string('100')->nullable();
您可能正在尝试做这样的事情:
$table->string('somestring', 100)->nullable();
关于Laravel 5.4 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47144748/