Adicione o campo a muitos a muitos relacionamentos Laravel
//in Model
public function products()
{
return $this->belongsToMany(Product::class)
->withPivot('status')
->withTimestamps();
}
//in Migration
Schema::create('vendor_product', function (Blueprint $table) {
$table->unsignedBigInteger('product_id');
$table->foreign('product_id', 'product_id_fk_6766249')->references('id')->on('products')->onDelete('cascade');
$table->unsignedBigInteger('vendor_id');
$table->foreign('vendor_id', 'vendor_id_fk_6766249')->references('id')->on('vendors')->onDelete('cascade');
$table->string('status');
$table->timestamps();
});
Snippets