How to enable query log in Laravel?

0 votes
In Laravel is there any service that can provide all the query service via some query log and how to achieve them?

Thank you!
Mar 23 in Laravel by kartik
• 15,560 points
36 views

1 answer to this question.

0 votes

Hello,

You can use simple function that is available in Laravel.

Use the enableQueryLog method to enable query log in Laravel

DB::connection()->enableQueryLog(); 
You can get array of the executed queries by using getQueryLog method:
$queries = DB::getQueryLog();
answered Mar 23 by Niroj
• 32,440 points

Related Questions In Laravel

0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18 in Laravel by Niroj
• 32,440 points
432 views
0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19 in Laravel by Niroj
• 32,440 points
49 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19 in Laravel by Niroj
• 32,440 points
173 views
0 votes
1 answer

How to delete or clear caching in Laravel?

Hey @kartik, There are many commands to clear ...READ MORE

answered Mar 20 in Laravel by Niroj
• 32,440 points
79 views
0 votes
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 32,440 points
818 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 32,440 points
82 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 32,440 points
94 views
0 votes
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 32,440 points
440 views
0 votes
1 answer

How to enable or disable maintenance mode in Laravel?

Hii, We have to use the following artisan ...READ MORE

answered Mar 24 in Laravel by Niroj
• 32,440 points
240 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18 in Laravel by Niroj
• 32,440 points
191 views