当前位置:网站首页>Laravel scheduled task
Laravel scheduled task
2022-06-24 23:12:00 【Wang Daochang's way of programming】
One 、 Custom task method
php artisan make:command Task
Two 、 Self generated task class
protected $signature = 'command:name';// Name of the task to be performed
public function handle()
{
/* * This method does the specific processing of the task , That is, the operation of data , Available models For example, I want to delete the user table ID by 1 Users of * */
DB::table('user')->where('id',1)->delete();
}
3、 ... and 、 register
# Go to App\Console\kernel.php
protected $commands = [
// Introduce the newly created class
\App\Console\Commands\Task::class
];
protected function schedule(Schedule $schedule){
// This is equivalent to specifying the agreed scheduled execution time , For example, perform the following tasks every minute
// command('command:name') The writing should be consistent with what we just Task In the file $signature identical
$schedule->command('command:name')->everyMinute();
}
Four 、 function
php artisan schedule:run
边栏推荐
- 京东618会议平板排行榜公布,新锐黑马品牌会参谋角逐前三名,向国货老大华为学习
- Building Survey [2]
- JD 618 conference tablet ranking list announced that the new dark horse brand staff will compete for the top three, learning from Huawei, the leader of domestic products
- Blogs personal blog test point (manual test)
- Market trend report, technical innovation and market forecast of solar roof system in China
- It's hard to hear C language? Why don't you take a look at my article (7) input and output
- 研究生宿舍大盘点!令人羡慕的研究生宿舍来了!
- EPICS记录参考3 -- 所有记录都有的字段
- Selection (029) - what is the output of the following code?
- 并发之共享模型管程
猜你喜欢
![[Wuhan University] information sharing of the first and second postgraduate entrance examinations](/img/ec/884e656a921e20a5679a2960c9ac4d.jpg)
[Wuhan University] information sharing of the first and second postgraduate entrance examinations

Beijiafu (p+f) R2000 modified radar IP

What kind of processor architecture is ARM architecture?

并发之共享模型管程

Development specification - parameter verification exception, exception return prompt section

非单文件组件

The extra points and sharp tools are worthy of the trust | know that Chuangyu won the letter of thanks from the defense side of the attack and defense drill!

Second IPO of Huafang group: grown up in Zanthoxylum bungeanum, trapped in Zanthoxylum bungeanum

High level application of SQL statements in MySQL database (I)

Are you afraid of being asked MySQL related questions during the interview? This 30000 word essence summary + 100 interview questions, and it's enough to hang the interviewer
随机推荐
EPICS record Reference 3 - - field available for all Records
The extra points and sharp tools are worthy of the trust | know that Chuangyu won the letter of thanks from the defense side of the attack and defense drill!
Selection (026) - what is the output of the following code?
Research Report on market evaluation and investment direction of Chinese dermatology drugs (2022 Edition)
大厂面试必问:如何解决TCP可靠传输问题?8张图带你详细学习
Learn more about redis' eight data types and application scenario analysis
03_ Spingboot core profile
Building Survey [3]
laravel model 注意事项
Solution to the login error of tangdou people
Docker installation MySQL simple without pit
New, Huawei cloud Kaitian apaas
01_SpingBoot 框架入门
Epics record reference 4 -- fields for all input records and fields for all output records
Research Report on market supply and demand and strategy of ceiling power supply device industry in China
2022 simulated 100 questions and simulated examination of high-altitude installation, maintenance and demolition
剑指 Offer 13. 机器人的运动范围
Cat write multiline content to file
go Cobra命令行工具入门
Financial management [4]