-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathGenerateAppEventCommand.php
More file actions
39 lines (30 loc) · 807 Bytes
/
GenerateAppEventCommand.php
File metadata and controls
39 lines (30 loc) · 807 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
37
38
39
<?php
declare(strict_types=1);
namespace Bow\Console\Command\Generator;
use Bow\Console\AbstractCommand;
use Bow\Console\Generator;
class GenerateAppEventCommand extends AbstractCommand
{
/**
* Add event
*
* @param string $event
* @return void
*/
public function run(string $event): void
{
$generator = new Generator(
$this->setting->getEventDirectory(),
$event
);
if ($generator->fileExists()) {
echo "\033[0;31mThe event already exists.\033[00m\n";
exit(1);
}
$generator->write('event', [
'baseNamespace' => $this->namespaces['event'] ?? 'App\\Events'
]);
echo "\033[0;32mThe event has been well created.\033[00m\n";
exit(0);
}
}