public function lockForUpdate() { \DB::transaction(function () { $update = JasperReportParam::where('ID','=', 26262)->lockForUpdate()->first(); $update->ID = 26262; $update->status = 'LOCK'; $update->save(); }); }* The selected row will be locked from being selected or updated by other process. This will solve race condition issue in updating the same record.
Tuesday, September 24, 2019
PHP Laravel Lock For Update with Eloquent
Labels:
PHP Laravel Framework
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment