Task schedule Laravel 5.4

Опубликовано: 19 Апрель 2025
на канале: ijc
6,924
13

Introduction:

Starting the scheduler:
php /path-to-yourproject/artisan schedule:run ]]]] /dev/null 2]]&1

Defining schedules
$schedule-]]command('emails:send --force')-]]daily();
$schedule-]]exec('node /abc.js')-]]daily();

Schedule Frequency Options
-]]cron('* * * * * *'): run the task on a custom cron schedule
-]]everyMinute(); Run the task every minute
-]]dailyAt('13:00')
-]]twiceDay(1,13)
-]]monthly(4, '13:00') (4th at 15:00)
quarter
-]] yearly
-]]timezone('Ameria/New_York')

-]]monday
-]]between()
-]]unlessBetween('23:00', '4:00')


truth Test constraints
-]]when execute if the callback function return true
-]]skip not execute when the call function return true


Preventing Task Overlaps
$schedule-]]command('emails:send')-]]withoutOverlapping();

Maintenance Mode
$schedule-]]command('emails:send')-]]evenInMaintenanceMod();
Task Output
-]]daily()-]]sendOutputTo($filepath)
-]]daily()-]]appendOutputTo($filepath)
-]]daily()-]]emailOutputTo('[email protected]')
Just support for command
Task Hooks:
-]]daily()-]]before(() =]] {}) =]] after()
Pinging URLS:
-]]daily()-]]pingBefore($url)-]]thenPing($url)
require guzzle

-----

I like to study together. If you think like me please contact as below. Thanks for your watching.

Contact info:
email: [email protected]
www: mydeveloper.info

mysql:639545
user: tuanphpvn
pass: TTT261@ttt