How to create cron job in laravel | Automatically send emails | task scheduling with cron job

The App Engine Cron Service allows you to configure regularly scheduled tasks that operate at defined times or regular intervals. These tasks are commonly known as cron jobs. These cron jobs are automatically triggered by the App Engine Cron Service.

Step 1 : Go to command prompt and execute below command.

php artisan make:command cronEmail 

Step 2 : Go to cronEmail.php file and write your code for send mail within function handle()

Step 3 : Go to app/Console/Kernel.php file and register your cron command

'App\Console\Commands\cronEmail'

Step 4 : Now check what is your hosting provider time because cron job run on your hosting provider time

https://check-host.net/

Step 5 : Goto your hosting provider dashboard and find Cron Job

/usr/local/bin/php /home/your_user_name/public_html/your_website_folder_name/artisan notify:email 

Related Posts

Divyesh Patel

I'm Divyesh Patel, Web & App developer. I want to make things that make a difference. With every line of code, i strive to make the web a beautiful place.

Leave a Reply

Your email address will not be published. Required fields are marked *