我想知道大多数开发人员如何使用这两个Laravel工具。
在Laravel中,您可以使用“服务”或“作业”来处理业务逻辑(让我们仅讨论不可排队的作业,仅讨论那些在同一流程中运行的作业)。
例如,一个用户想要创建一个实体,比如说一本书,您可以使用服务来处理该实体的创建或调度一个工作。
使用工作将是这样的:
class PostBook extends Job
{
...
public function handle(Book $bookEntity)
{
// Business logic here.
}
...
}
class BooksController extends Controller
{
public function store(Request $request)
{
...
dispatch(new PostBook($request->all()));
...
}
}
Run Code Online (Sandbox Code Playgroud)
使用服务,将是这样的:
class BookService
{
public function store(Request $request)
{
// Business logic here.
}
}
class BooksController extends Controller
{
public function store(Request $request)
{
...
// I could inject the service instead.
$bookService = $this->app()->make(App\Services\BookService::class);
$bookService->store($request);
... …Run Code Online (Sandbox Code Playgroud) 我有这个问题:
我已经做了什么:
view path not found)以下两行有什么区别?
mov ax, bx
mov ax, [bx]
Run Code Online (Sandbox Code Playgroud)
如果bx包含值100h且存储器地址100h的值为23,那么第二个复制23到ax?
另外,以下两行之间有什么区别?
mov ax, 102h ; moves value of 102h into register ax
mov ax, [102h] ; Actual address is DS:0 + 102h
Run Code Online (Sandbox Code Playgroud)