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
Next.js Basics for Laravel Developers
11 lessons
58 min
Laravel 13 Eloquent: Expert Level
41 lessons
1 h 34 min
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read