@@ -266,23 +266,23 @@ it is simply a personal preference for readability and writing less code, when a
266
266
it's instantiated.
267
267
- The order of parameters that we use when calling a job with its class name is irrelevant to their order in the
268
268
Job's constructor signature. i.e.
269
- ```php
270
- $this->run(LogUserSearchJob::class, [
271
- 'date' => new DateTime(),
272
- 'query' => $request->input(),
273
- 'resultIds' => $results->lists('id'), // only the ids of the results are required
274
- ] );
275
- ```
276
- ```php
277
- class LogUserSearchJob
269
+ ``` php
270
+ $this->run(LogUserSearchJob::class, [
271
+ 'date' => new DateTime(),
272
+ 'query' => $request->input(),
273
+ 'resultIds' => $results->lists('id'), // only the ids of the results are required
274
+ ]);
275
+ ```
276
+ ``` php
277
+ class LogUserSearchJob
278
+ {
279
+ public function __construct($query, array $resultIds, DateTime $date)
278
280
{
279
- public function __ construct($query, array $resultIds, DateTime $date)
280
- {
281
- // ...
282
- }
281
+ // ...
283
282
}
284
- ```
285
- This will work perfectly fine, as long as the key name (` 'resultIds' => ... ` ) is the same as the variable's name in the constructor (` $resultIds ` )
283
+ }
284
+ ```
285
+ This will work perfectly fine, as long as the key name (` 'resultIds' => ... ` ) is the same as the variable's name in the constructor (` $resultIds ` )
286
286
- Of course, we need to create and import (` use ` ) our Job classes with the correct namespaces, but we won't do that here
287
287
since this is only to showcase and not intended to be running, for a working example see [ Getting Started] ( #getting-started ) .
288
288
0 commit comments