嗨,所以当我试图将我的表单提交到我的数据库时,我会得到以下错误
错误
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'urenregistratie.issues' doesn't exist (SQL: insert into `issues` (`iname`, `begroting`, `description`, `updated_at`, `created_at`) values (test, 100, test description, 2019-12-04 09:19:54, 2019-12-04 09:19:54))控制器
public function store(Request $request)
{
$this->validate($request,[
'iname' => 'required',
'begroting' => 'required',
'description' => 'required',
]);
$issue = new Issue;
$issue->iname = $request->input('iname');
$issue->begroting = $request->input('begroting');
$issue->description = $request->input('description');
$issue->save();
return redirect('/issue')->with('success', 'Data Saved');
}迁移
public function up()
{
Schema::create('issue', function (Blueprint $table) {
$table->increments('id');
$table->string('iname');
$table->time('begroting');
$table->mediumText('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('issue');
}
}是我的数据库名。但是我不知道问题是从哪里来的,因为我把它叫做没有S的问题,那么它从哪里得到这些问题呢?
如果我遗漏了什么,如果我知道的话,那就明智之举。
发布于 2019-12-04 09:58:22
您的迁移将创建问题表,但您将保存到 creates 表。检查模型类中的表名。
class Issue extends Model
{
protected $table = 'issue'; // this table name
.
.
.
}https://stackoverflow.com/questions/59173227
复制相似问题