✨
Virtue
View on GitHub
  • ✨Virtue
  • 🚀GETTING STARTED
    • Installation
    • Changelog
  • 🛠️MODEL ATTRIBUTES
    • Configuration
    • Cast
    • Database
    • Dispatches Events
    • Fillable
    • Hidden
    • Primary Key
    • Relationships
  • 💻COMMAND ATTRIBUTES
    • Configuration
    • Defining Arguments
    • Defining Options
Powered by GitBook
On this page

Was this helpful?

  1. COMMAND ATTRIBUTES

Configuration

To enable the attributes provided by this package, you need to use the WendellAdriel\Virtue\Commands\Concerns\Virtue trait to your Commands.

You also need to update the command to not use a $signature property, but only define the $name for it. This is to avoid issues with arguments and options defined in the $signature.

Instead of this:

use Illuminate\Console\Command;

final class TestCommand extends Command
{
    protected $signature = 'app:test {name}';

    protected $description = 'Command description';

    public function handle()
    {
        // Command code here
    }
}

Update to this:

use Illuminate\Console\Command;
use WendellAdriel\Virtue\Commands\Concerns\Virtue;

final class TestCommand extends Command
{
    use Virtue;

    protected $name = 'app:test';

    protected $description = 'Command description';

    public function handle()
    {
        // Command code here
    }
}
PreviousRelationshipsNextDefining Arguments

Last updated 1 year ago

Was this helpful?

💻