Reputation: 49
I am developing a school management system with Laravel 5.4. When I migrate the the database table I get this error msg:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '100' (T_LNUMBER), expecting ',' or ')'
Please help me, how do I solve this error?
Migration:
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();
}); }
Upvotes: 2
Views: 82
Reputation: 13244
This is not allowed:
$table->string('100')->nullable();
you probably where trying to do something like this :
$table->string('somestring', 100)->nullable();
Upvotes: 1
Reputation: 2609
I presume that you are using a mysql database, In mysql database column names cannot be of full numeric characters, unless you put them in quotes. refer the doc here. which says,
Identifiers may begin with a digit but unless quoted may not consist solely of digits.
I think it is a typo from your side. If you really want to want to name your column 100
consider renaming it to field100
or something like that.
Upvotes: 1