Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/larapack/command-verification

Makes Artisan Commands prompt the console if it should continue.
https://github.com/larapack/command-verification

Last synced: about 2 months ago
JSON representation

Makes Artisan Commands prompt the console if it should continue.

Awesome Lists containing this project

README

        

# Laravel Command Verification
Makes Artisan Commands prompt the console if it should continue.

## Installing

Install using composer `composer require larapack/command-verification 1.*`.

## Usage

First add the trait `Verifiable` to your Artisan Command.
```
verify();
}
```

If the user accept it will call the `verified`-method, so ensure you define that.
```
public function verified()
{
$this->info('We have destroyed your entire site. Thanks for using our command.');
}
```

It will look like this:

![Command Line Example](https://raw.githubusercontent.com/larapack/command-verification/master/resources/command-line-example.png)

## Customizing

When calling the `verify`-method you can add the following parameters: `$this->verify($message, Closure $callback)`
```
public function fire()
{
return $this->verify('A custom verify message', function() {
$this->info('We have destroyed your entire site. Thanks for using our command.');
});
}
```

This way you can overwrite the default verify message and the callback.