gpt4 book ai didi

mysql - Laravel 错误查询插入

转载 作者:行者123 更新时间:2023-11-29 09:37:47 25 4
gpt4 key购买 nike

我在将数据插入数据库时​​遇到问题,并且总是收到以下错误。

SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field

我尝试使用查询生成器通过我的 Eloquent 模型插入数据,但它给了我同样的错误。在迁移文件中我有:

Schema::create('books', function (Blueprint $table) {
$table->bigIncrements('id')->autoIncrement()->primary();
$table->text("name");
$table->multiLineString("opinion");
$table->string("post");
$table->timestamp("date");
});

我也尝试过这样插入数据:

$validatedData = $this->validate($request, [
'name' => 'required|alpha_dash|max:40|min:3',
'opinion' => 'required|alpha_dash|max:40|min:3',
]);

$validatedData = Binput::all();

DB::table("books")->insert([
"name" => $validatedData["name"],
"post" => $url,
"opinion" => $validatedData["opinion"],
]);

最佳答案

我不知道这个Binput::all();来自哪里。

您可以尝试删除此行$validatedData = Binput::all();

应该是:

$validatedData = $this->validate($request, [
'name' => 'required|alpha_dash|max:40|min:3',
'opinion' => 'required|alpha_dash|max:40|min:3',
]);

DB::table("books")->insert([
"name" => $validatedData["name"],
"post" => $url,
"opinion" => $validatedData["opinion"],
]);

关于mysql - Laravel 错误查询插入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57235147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com