-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
174cfe7
commit 8d3939e
Showing
27 changed files
with
1,077 additions
and
35 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
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,59 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\CraftsmanFileSystem; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
/** | ||
* Class CraftClass | ||
* @package App\Commands | ||
*/ | ||
class CraftCommand extends Command | ||
{ | ||
protected $signature = 'craft:command | ||
{name : Command name} | ||
{--s|signature= : Command Signature} | ||
{--d|description= : Command Description} | ||
{--t|template= : Template path (override configuration file)} | ||
{--w|overwrite : Overwrite existing class} | ||
'; | ||
|
||
protected $description = "Craft Laravel Command"; | ||
|
||
protected $help = 'Craft Command | ||
<name> Command Name | ||
--signature, -s Command Signature | ||
--description, -d Command Description | ||
--template, -t Path to custom template (override config file) | ||
--overwrite, -w Overwrite existing class | ||
'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->fs = new CraftsmanFileSystem(); | ||
|
||
$this->setHelp($this->help); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$className = $this->argument('name'); | ||
|
||
$signature = $this->option('signature') ?: 'command:name'; | ||
$description = $this->option('description') ?: 'Command description'; | ||
|
||
$data = [ | ||
"name" => $className, | ||
"signature" => $signature, | ||
"description" => $description, | ||
"template" => $this->option("template"), | ||
"overwrite" => $this->option("overwrite"), | ||
]; | ||
|
||
$this->fs->createFile('command', $className, $data); | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\CraftsmanFileSystem; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
/** | ||
* Class CraftClass | ||
* @package App\Commands | ||
*/ | ||
class CraftEvent extends Command | ||
{ | ||
protected $signature = 'craft:event | ||
{name : Event name} | ||
{--b|no-broadcast : Skip broadcasting} | ||
{--t|template= : Template path (override configuration file)} | ||
{--w|overwrite : Overwrite existing class} | ||
'; | ||
|
||
protected $description = "Craft Event Class"; | ||
|
||
protected $help = 'Craft Event | ||
<name> Class Name | ||
--no-broadcast, -b Skip broadcasting | ||
--template, -t Path to custom template (override config file) | ||
--overwrite, -w Overwrite existing class | ||
'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->fs = new CraftsmanFileSystem(); | ||
|
||
$this->setHelp($this->help); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$className = $this->argument('name'); | ||
|
||
$data = [ | ||
"name" => $className, | ||
"no-broadcast" => $this->option("no-broadcast"), | ||
"template" => $this->option("template"), | ||
"overwrite" => $this->option("overwrite"), | ||
]; | ||
|
||
$this->fs->createFile('event', $className, $data); | ||
} | ||
} |
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,58 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\CraftsmanFileSystem; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
/** | ||
* Class CraftClass | ||
* @package App\Commands | ||
*/ | ||
class CraftListener extends Command | ||
{ | ||
protected $signature = 'craft:listener | ||
{name : Listener name} | ||
{--e|event= : The event class be listener for} | ||
{--queued : Indicates the event listener should be queued} | ||
{--t|template= : Template path (override configuration file)} | ||
{--w|overwrite : Overwrite existing class} | ||
'; | ||
|
||
protected $description = "Craft Listener Classes"; | ||
|
||
protected $help = 'Craft Listener | ||
<name> Class Name | ||
--event, -e The event class be listener for | ||
--queued Indicates the event listener should be queued | ||
--template, -t Path to custom template (override config file) | ||
--overwrite, -w Overwrite existing class | ||
'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->fs = new CraftsmanFileSystem(); | ||
|
||
$this->setHelp($this->help); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$className = $this->argument('name'); | ||
|
||
$data = [ | ||
"name" => $className, | ||
"event" => $this->option("event"), | ||
"queued" => $this->option("queued"), | ||
"template" => $this->option("template"), | ||
"overwrite" => $this->option("overwrite"), | ||
]; | ||
|
||
$data["useEvent"] = strlen($data["event"]) > 0; | ||
|
||
$this->fs->createFile('listener', $className, $data); | ||
} | ||
} |
Oops, something went wrong.