Description
Optimize Your DB Queries with AI
You can register the commands with your scheduler.
php artisan slower:clean /*{days=15} Delete records older than 15 days.*/php artisan slower:analyze /*Analyze the records where is_analyzed=false*/
use HalilCosdu\Slower\Commands\AnalyzeQuery;use HalilCosdu\Slower\Commands\SlowLogCleaner; protected $commands = [ AnalyzeQuery::class, SlowLogCleaner::class,]; /** * Define the application's command schedule. */protected function schedule(Schedule $schedule): void{ $schedule->command(AnalyzeQuery::class)->runInBackground()->daily(); $schedule->command(SlowLogCleaner::class)->runInBackground()->daily();}
$model = \HalilCosdu\Slower\Models\SlowLog::first(); \HalilCosdu\Slower\Facades\Slower::analyze($model): Model; dd($model->raw_sql); /*select count(*) as aggregate from "product_prices" where "product_id" = '1' and "price" = '0' and "discount_total" > '0'*/ dd($model->recommendation);
Example Screen
Related Content on Laravel Daily
Recent Courses on Laravel Daily
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min
Testing in Laravel 13 For Beginners
26 lessons
1 h 41 min read
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read