Laravel does not provide the command to create Traits out of the box but Laravel does provide commands generation for almost all kinds of components. This package introduces the convenience of Laravel's artisan makes for trait generation.
You can install the package via composer:
composer require rifrocket/trait-console
For Laravel 5.4 and lower, add the following line to your config/app.php
Rifrocket\TraitConsole\TraitConsoleServiceProvider::class,
trait will be created in the App/Traits directory.
php artisan make:trait NameOfYourTrait
You may create traits in subdirectories to organize them as per your need
php artisan make:trait Subdirectory/NameOfYourTrait
trait will be created in the App/Traits/Subdirectory directory and namespaced appropriately.
-b or --boot
php artisan make:trait NameOfYourTrait -b MethodName
Creates a trait with a boot method named bootMethodName.
-s or --scope
php artisan make:trait NameOfYourTrait -s MethodName
Creates a trait with a scope method named scopeMethodName.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.