Created
February 13, 2021 16:15
-
-
Save AnandPilania/9d7f34da746184a3ca1617bc890be473 to your computer and use it in GitHub Desktop.
Easily create your own scaffold via Laravel Command; example: generate `Traits`
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
<?php | |
namespace {{ namespace }}; | |
trait {{ class }} | |
{} |
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
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Console\GeneratorCommand; | |
class TraitMakeCommand extends GeneratorCommand | |
{ | |
protected $name = 'make:trait'; | |
protected $type = 'Trait'; | |
protected $description = 'Make Traits'; | |
protected function getStub() | |
{ | |
return __DIR__ . '/stubs/trait.stub'; | |
} | |
protected function getNameInput() | |
{ | |
return trim('Traits\\' . $this->argument('name')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment