为了账号安全,请及时绑定邮箱和手机立即绑定

无法删除 morphpivot 自定义模型 laravel

无法删除 morphpivot 自定义模型 laravel

PHP
慕田峪9158850 2023-08-26 15:55:57
我正在使用 Laravel 进行项目,并且在删除自定义 morphPivot 关系时遇到一些问题。当我尝试删除关系时,出现以下错误:Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause' (SQL: delete from `comment` where (`` = 01418755-c68e-4ea5-8043-cef348c47445))'从它我认为 laravel 正在尝试通过 ids 删除,但 id 列没有名称,所以它找不到它。但是,我认为我明确定义了 id 列。这是我的类实现:<?phpuse Illuminate\Support\Facades\Schema;use Illuminate\Database\Schema\Blueprint;use Illuminate\Database\Migrations\Migration;class CreateCommentTable extends Migration{    /**     * Run the migrations.     *     * @return void     */    public function up()    {        Schema::create('comment', function (Blueprint $table) {            $table->uuid('id');            $table->primary('id');            $table->text('content');            $table->boolean('spoiler')->default(false);            $table->boolean('hidden')->default(false);            $table->boolean('edited')->default(false);            $table->uuid('parent_id')->nullable();            $table->uuid('user_id');            $table->uuid('commentable_id');            $table->string('commentable_type');            $table->json('meta')->nullable();            $table->timestamps();        });    }    /**     * Reverse the migrations.     *     * @return void     */    public function down()    {        Schema::dropIfExists('comment');    }}
查看完整描述

1 回答

?
慕森王

TA贡献1777条经验 获得超3个赞

现已在 Laravel 最新版本中修复



查看完整回答
反对 回复 2023-08-26
  • 1 回答
  • 0 关注
  • 89 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信