-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bachable option to create:job command
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace {{ plugin_namespace }}\Jobs; | ||
|
||
use Illuminate\Bus\Batchable; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Queue\Middleware\SkipIfBatchCancelled; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class {{studly_name}} implements ShouldQueue | ||
{ | ||
use Batchable, Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
|
||
/** | ||
* Create a new job instance. | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Execute the job. | ||
*/ | ||
public function handle(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the middleware the job should pass through. | ||
*/ | ||
public function middleware() | ||
{ | ||
return []; // Remove this line to activate | ||
|
||
return [ | ||
// Instruct Laravel to not process the job if | ||
// its corresponding batch has been cancelled | ||
new SkipIfBatchCancelled() | ||
]; | ||
} | ||
} |