简体   繁体   English

Laravel 5.1工作和听众

[英]Laravel 5.1 jobs and listeners

So Laravel 5.1 changes the folders Commands to Jobs and Handlers to Listeners . 因此,Laravel 5.1将文件夹Commands to Jobs更改Commands to JobsHandlers to Listeners What I'm a bit confused about is that the Listeners folder now only handles Events and not Jobs. 我有点困惑的是,Listeners文件夹现在只处理事件而不是Jobs。 Are all Jobs self-handling in 5.1? 所有乔布斯都在5.1中进行自我处理吗? Or should i create a Handlers folder and handle the jobs in there? 或者我应该创建一个Handlers文件夹并处理那里的工作?

For now, Jobs are self-handling. 目前,乔布斯正在自我处理。 They are like Commands and implement the SelfHandling interface. 它们就像命令并实现SelfHandling接口。 The change is basically just a folder rename so people do not confuse it with other commands (eg console commands). 更改基本上只是一个文件夹重命名,因此人们不会将其与其他命令(例如控制台命令)混淆。 Try to think of a Job like a Command, since a command is actually performing a job. 尝试将Job视为一个命令,因为命令实际上是在执行一项工作。

Or still, you can create the app/Commands and app/Handlers directory and continue using commands as you are used to. 或者,您仍然可以创建app / Commands和app / Handlers目录,并继续使用您习惯使用的命令。 Jobs and Commands are just different ways to do the same thing. 工作和命令只是做同样事情的不同方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM