php LARAVEL:SQLSTATE[22007]:无效的日期时间格式:1292截断不正确的DOUBLE值

wribegjk  于 2023-09-29  发布在  PHP
关注(0)|答案(1)|浏览(123)

我试图创建一个路由来更新mysql表'orcamento'中的信息,我得到了这个错误
SQLSTATE[22007]:无效的日期时间格式:1292截断不正确的DOUBLE值:'$orcamento->id'(SQL:update orcamento set cliente = joao,vendedor =卡洛斯,descricao = 2 peças de vidro,valor = 600,orcamento . updated_at = 2020-08-15 08:15:40其中(id = $orcamento->id))
created_at和updated_at由时间戳构建

{
    Schema::create('orcamento', function (Blueprint $table) {
        $table->id();
        $table->text('vendedor');
        $table->text('cliente');
        $table->text('descricao');
        $table->double('valor',10,2);
        $table->timestamps();
    });
}

在路由更新中是这样

public function update(OrcamentoRequest $request, $id)
    {
        $orcamentos = ModelsOrcamentoModel::where(['id'=>$id])->update([
            'cliente'=>$request->cliente,
            'vendedor'=>$request->vendedor,
            'descricao'=>$request->descricao,
            'valor'=>$request->valor
        ]);
        return redirect('cadastros');
    }

执行dd函数我得到了这个

'$orcamentos = ModelsOrcamentoModel::where(['id'=>$id])->dd($id,$request->valor);'

“$orcamento->id”“600”

tp5buhyn

tp5buhyn1#

我在表单中传递了一个错误的url

<form action="{{url('orcamentos/'.$orcamento->id)}}" name="formEdit" id="formEdit" method="post">

相关问题