I'm trying to schedule a simple test command in Laravel 11 to log the current timestamp every minute. I've created a command named 'app:test-command' that logs the timestamp using theLog::error method. However, when I schedule it to run every minute using Artisan::command and start the scheduler with php artisan schedule:work, the command isn't executing.
@brunokaue Artisan::command() is for defining closure commands. You're passing it an empty closure, which is then scheduled and executed every minute. Use Schedule::command() instead to schedule an existing command:
use Illuminate\Support\Facades\Schedule;
Schedule::command('app:test-command')->everyMinute();