我想在 Laravel 应用程序的 db 表中更新用户的最后一行数据。我试图使用 orderBy id desc limit 1 但它无法工作。
DB::table('shortcontacts')->where('mobile',($data->mobile))->update(['otp_stts'=>'Verified'])->orderBy('id','desc')->first();
您应该将数据排序到 desc 然后像这样更新:
DB::table('shortcontacts')->where('mobile',($data->mobile))->orderBy('id','desc')->first()->update(['otp_stts'=>'Verified']);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句