skip to Main Content

How to send a primary key as a foreign key to another table while submitting the form in Laravel vue?

I have these 2 tables: Table one(parties): public function up() { Schema::create('parties', function (Blueprint $table) { $table->id(); $table->string('full_name'); $table->string('ic_passport'); $table->string('nationality'); $table->string('income_tax_no'); $table->string('income_Tax_filing_branch'); $table->string('phone_no'); $table->string('email'); $table->timestamps(); }); } Table two(corraddresses): public function up() { Schema::create('corraddresses', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('party_id');…

VIEW QUESTION

Laravel updateOrCreate with increment() method

I'm trying to update the stock field or create it when the model doesn't exists The eloquent : AppModelsMarketingStock::updateOrCreate( ['marketing_id' => $attr['marketing_id']], ['product_id' => $attr['product_id']], )->increment('stock',$attr['qty']); The model : class MarketingStock extends Model { use HasFactory; protected $fillable = ['marketing_id','product_id','stock'];…

VIEW QUESTION
Back To Top
Search