schroedingerswg
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: https://flareapp.io/share/W7zpqzmw

this is where the error happens:

$this->belongsToMany('App\ProductSingle',"product_singles","product_id");

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         });
 62

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

full code: https://gitlab.com/domezi/s2

Thank you very much for any help!

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