Read Story
Watch Main Stage Talk
Download Now
Naresh Verma

How To Schedule Jobs in Bagisto?

If you are trying to executing a periodic task on the server like for sending emails, database cleanup and generating reports. To automate these tasks We use  Laravel cron jobs scheduling. This article is all about How To Schedule Jobs in Bagisto?

In Bagisto We can also achieve this by the following steps:

Step 1

You should be in the root folder of your application and run the following commands from your terminal:

php artisan make:command  Command Name(userUpdate).

This command will create a new command class in the app/Console/Commands directory. In  to this class  you will find the following code in it and just Place this file to your packages Console/Commands directory:

Just change the name space of the command class according to your package.

Step 2

As you can see:

protected $signature = ‘command:name’;

Whatever you replace the words command:name with it will be used to execute the command that you have created before like:

protected $signature = ‘user:update’;

Step 3

write your code/logic in the handle method:

Step 4

Register command in your package ServiceProvider’s Register method :

Step 5

Now run the following command:

Step 6

Add the following cron expression to the crontab for automatic User Update information:

You can also check your command by running : php artisan list.

In the above Cron expression(* * * * *) , each field is an option to determine task schedule frequency. These options represent minute, hour, day of the month, month and day of the week in the given order. Asterisk symbol means all possible values. So, the above command will run every 30 minutes.

So this was all about How To Schedule Jobs in Bagisto? hope it will be helpful for you. If you have any issue feel free to raise a ticket at https://bagisto.uvdesk.com/en/

reference : Laravel Cron Job

. . .

Comment

Add Your Comment

Be the first to comment.

css.php