Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 所有的迁移工作都不适当_Sql_Laravel - Fatal编程技术网

Sql 所有的迁移工作都不适当

Sql 所有的迁移工作都不适当,sql,laravel,Sql,Laravel,这是我在尝试打开表单后遇到的错误。下面是代码。这花了我一整天的时间,所以请帮助我 SQLSTATE[42S22]:未找到列:“字段列表”中的1054未知列“id”(SQL:从admissions中选择max(id)作为聚合,其中admissions处删除的为空) 这里是迁移 Schema::create('admissions', function (Blueprint $table) { $table->bigIncrements('student_id'); $table-

这是我在尝试打开表单后遇到的错误。下面是代码。这花了我一整天的时间,所以请帮助我

SQLSTATE[42S22]:未找到列:“字段列表”中的1054未知列“id”(SQL:从
admissions
中选择max(
id
)作为聚合,其中
admissions
处删除的
为空)

这里是迁移

Schema::create('admissions', function (Blueprint $table) {
   $table->bigIncrements('student_id');
   $table->string('roll_no');
   $table->string('last_name');
   $table->string('father_name');
   $table->string('father_phone');
   $table->string('mother_name');
   $table->string('gender');
   $table->string('email')->unique();
   $table->date('dob');
   $table->string('phone');
   $table->longText('address');
   $table->longText('current_address');
   $table->string('nationality');
   $table->string('passport');
   $table->tinyInteger('status');
   $table->date('dateregistered');
   $table->integer('user_id');
   $table->integer('class_id');
   $table->string('image')->nullable();
   $table->softDeletes();
   $table->timestamps();
}
这表示此表的主键是
student\u id
而不是
id

Replace 
$admissions = Admission::max('id');

to 
$student_id = Admission::max('student_id');
这表示此表的主键是
student\u id
而不是
id

Replace 
$admissions = Admission::max('id');

to 
$student_id = Admission::max('student_id');

好的,让我们看一下该表的迁移让我们看一下你的录取表我已经分享了我的录取表好的,让我们看一下该表的迁移让我们看一下你的录取表我已经分享了我的录取表我在更正后得到了:未定义变量:student_idPlease你能用示例形式吗?谢谢你的帮助。检查我的最新答案。你需要将第二行替换为我在回答中给你的那一行。我在更正后得到:未定义变量:student_idPlease你能用示例形式吗?谢谢你的帮助。检查我的最新答案。你需要用我在回答中给你的那一行替换第二行
Replace 
$admissions = Admission::max('id');

to 
$student_id = Admission::max('student_id');