usePublicPath($app->basePath('public_html')); return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { // }) ->withSchedule(function (Schedule $schedule): void { // ========================================================================= // Job Fetching - Fetch fresh jobs from external APIs // ========================================================================= // Fetch jobs every 2 hours to keep listings fresh // Limit per source to avoid rate limits and keep queue manageable $schedule->command('jobs:fetch --limit=50') ->everyTwoHours() ->withoutOverlapping() ->onOneServer() ->runInBackground(); // ========================================================================= // Job Enrichment - Auto-categorize and enhance job data // ========================================================================= // Enrich new jobs every 6 hours (categorization, experience level detection) // This runs after jobs have been fetched to categorize uncategorized jobs $schedule->command('jobs:enrich') ->everySixHours() ->withoutOverlapping() ->onOneServer() ->runInBackground(); // ========================================================================= // Job Deduplication - Remove duplicate job listings // ========================================================================= // Deduplicate jobs daily at 3 AM (after fetch cycles have completed) // Daily is better than weekly to keep listings clean $schedule->command('jobs:deduplicate') ->dailyAt('03:00') ->onOneServer() ->runInBackground(); // ========================================================================= // Job Cleanup - Remove expired and old jobs // ========================================================================= // Clean up expired and old jobs daily at 2 AM // Keeps database lean and removes stale listings $schedule->command('jobs:clean --days=45') ->dailyAt('02:00') ->onOneServer() ->runInBackground(); // ========================================================================= // Cache Management - Keep caches fresh // ========================================================================= // Prune stale cache tags hourly $schedule->command('cache:prune-stale-tags') ->hourly() ->onOneServer(); }) ->withExceptions(function (Exceptions $exceptions): void { // })->create();