Good evening folks. I have a laravel setup and I'm trying to have a cronjob execute a php function to a file within the laravel project directory.
I am getting class and name space errors when I try to do something like this:
and then calling the
This of course gives me errors, what is the correct way to call my function within the laravel directory? I need to call this function as this function has all the correct namespaces and extended controllers necessary to execute the function properly.
Thanks to @michael, I've been made aware of a component in Laravel called
So I ran this code:
php artisan make:console processQueuedNotifications and it created some files in the console directory.
Currently exploring on what to do next.
After checking out the
Events class which the
kernel.phpfile makes use of, I noticed that this class provides an easy to use interface for me to create cron jobs on the fly. Am I correct in think so?
I notice there is not function to run a cron job every minute, is it safe to edit the
Eventsclass file without it being overwritten by future
make:consolecommands, or laravel updates?
I saw this code in the
So is this the place you wanted me to add my function? as I notice that the inspire function is something automatically created for me to understand what's going on?
So I would write,
$schedule->command('processQueuedNotifications') ->everyMinute(); //Providing it's safe to edit the Event's class or figure out a clean way of doing so without my code being deleted in the future on Laravel updates.