-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCreateBulk.php
More file actions
36 lines (28 loc) · 914 Bytes
/
CreateBulk.php
File metadata and controls
36 lines (28 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace App\Console\Commands\Invitation;
use App\Helper\InviteHelper;
use App\Jobs\InvitationCreateJob;
use Illuminate\Console\Command;
class CreateBulk extends Command {
protected $signature = 'wbs-invitation:create-bulk {numCodes}';
protected $description = 'Create an bulk invitations';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$numCodes = trim($this->argument('numCodes'));
$helper = new InviteHelper;
for ($i = 0; $i < $numCodes; $i++) {
$code = $helper->generate();
$jobResult = new InvitationCreateJob($code)->handle();
if ($jobResult) {
$this->line('Successfully created invitation: ' . $code);
} else {
$this->line('Failed to create invitation: ' . $code);
}
}
return 0;
}
}