1 month ago

Getting error on one-to-many relation

Posted 1 month ago by schroedingerswg

Hey, I receive this error, when trying to get the relation:

this is where the error happens:


my table structure:

 55  Schema::create('product_singles', function (Blueprint $table) {
 56             $table->id();
 57             $table->string("sn");
 58             $table->string("qrcode")->nullable();
 59             $table->unsignedBigInteger("product_id");
 60             $table->foreign("product_id")->references("id")->on("products")->onDelete("cascade");
 61         });

I suppose, i have to change my ->belongsToMany relation somehow

full code:

Thank you very much for any help!

Please sign in or create an account to participate in this conversation.