Thank you for the reply and sorry for my delay; too much going on!
Anyway...
- app/Console/Kernel.php currently contains:
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule)
{
dd('schedule() was called');
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
So, this is without errors and has the dummy command in place; with the correct use statement at the top.
I then did this:
composer dump-autoload -o
Which gave me this:
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
inertiajs/inertia-laravel ................................................................................................................... DONE
laravel/fortify ............................................................................................................................. DONE
laravel/jetstream ........................................................................................................................... DONE
laravel/sanctum ............................................................................................................................. DONE
laravel/tinker .............................................................................................................................. DONE
nesbot/carbon ............................................................................................................................... DONE
nunomaduro/termwind ......................................................................................................................... DONE
tightenco/ziggy ............................................................................................................................. DONE
Generated optimized autoload files containing 5375 classes
Followed by this:
php artisan schedule:list
Which returned this:
INFO No scheduled tasks have been defined.
And, for the first time, did this:
php artisan schedule:run
and got this:
INFO No scheduled commands are ready to run.
I can see that crontabs is running the root cron every minute:
Jun 21 20:24:01 ********: (root) CMD (cd /home/********/laravel/******** && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1)
Jun 21 20:25:01 ********:(root) CMD (cd /home/********/laravel/******** && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1)
And, yes, I just edited those lines with ********; they aren't in the command. :)
So, the cron is being called.
I have checked and the system IS using /usr/local/bin/php and that this is version 8.2.28
Laravel is version 11.41.3
In app.php I have this:
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use App\Console\Kernel as ConsoleKernel;
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) {
$middleware->web(append: [
\App\Http\Middleware\HandleInertiaRequests::class,
\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class,
]);
//
})
// ->withConsoleKernel(ConsoleKernel::class)
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
When I introduce the 4th line up (ConsoleKernel) the site crashes.
I believe this is down to the incorrect use statement; that my use is Laravel 10 and I am on Laravel 11.
So, my understanding is (sicne this was built on 10 then factored across to 11)
I should now have use Illuminate\Console\Application as Artisan;
use Illuminate\Foundation\Console\Kernel;
make a class change in Kernel.php.
Does this all sound correct?