Lets say i have a query that gets a post
model with its comment
model. So the query should look something like this
Post::with(['comments'])->get();
Now, i want to implement laravel's pessimistic locking like so
Post::with(['comments'])->sharedLock()->get();
Will it lock the rows from the comment's table as well? The documentation mention,
A shared lock prevents the selected rows from being modified until your transaction commits
The documentation gives an example of retrieving 1 model instance with no relationship. So i am unclear weather it applies to the main model and its relationship as well.