I have some throuble because my queries not have with (nolock) instruction after from clause.
Because that, some queries lock the database and then nobody can use the system.
How to use with (nolock) with Eloquent & Query Builder?
For example.. in this query:
return static::with('campaignType')
->where('active', 1)
->get();
I want the follow result:
select
*
from campaigns with (nolock)
inner join campaign_types with (nolock) on campaign_types.id = campaigns.campaign_type_id
where campaigns.active = 1
You can set "with(nolock)" like this:
DB::table('campaigns')->lock('WITH(NOLOCK)')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With