According to the Laravel documentation, the lockForUpdate method will lock the selected rows until the end of the transaction. This means that in the example provided, the rows that contain $values on table_1 will be locked until the transaction is either committed or rolled back.
Therefore, other users will not be able to select or modify these rows until the transaction is completed. The lock will be released automatically when the transaction is finished, regardless of whether or not a select query is executed on table_1.
Code Example:
N/A