I saw most of examples in Pessimistic locking by using query builder, like in below.
DB::table('users')->where('votes', '>', 100)->lockForUpdate()->get();
How can I use Pessimistic locking with Eloquent in laravel?
I saw most of examples in Pessimistic locking by using query builder, like in below.
DB::table('users')->where('votes', '>', 100)->lockForUpdate()->get();
How can I use Pessimistic locking with Eloquent in laravel?
To do this you simply need to use the model as normal. As stated in Maraboc's comment just use the Eloquent model and set filters and call lockForUpdate before the get().
Example: User::where('votes', '>', 100)->lockForUpdate()->get();