skip to Main Content

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