laravel-6 support
This commit is contained in:
65
vendor/facade/ignition/src/Commands/SolutionMakeCommand.php
vendored
Normal file
65
vendor/facade/ignition/src/Commands/SolutionMakeCommand.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Facade\Ignition\Commands;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class SolutionMakeCommand extends GeneratorCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'ignition:make-solution';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new custom Ignition solution class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Solution';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('runnable')
|
||||
? __DIR__.'/stubs/runnable-solution.stub'
|
||||
: __DIR__.'/stubs/solution.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Solutions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['runnable', null, InputOption::VALUE_NONE, 'Create runnable solution'],
|
||||
];
|
||||
}
|
||||
}
|
||||
85
vendor/facade/ignition/src/Commands/TestCommand.php
vendored
Normal file
85
vendor/facade/ignition/src/Commands/TestCommand.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Facade\Ignition\Commands;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Config\Repository;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Log\LogManager;
|
||||
|
||||
class TestCommand extends Command
|
||||
{
|
||||
protected $signature = 'flare:test';
|
||||
|
||||
protected $description = 'Send a test notification to Flare';
|
||||
|
||||
/** @var \Illuminate\Config\Repository */
|
||||
protected $config;
|
||||
|
||||
public function handle(Repository $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
$this->checkFlareKey();
|
||||
|
||||
if (app()->make('log') instanceof LogManager) {
|
||||
$this->checkFlareLogger();
|
||||
}
|
||||
|
||||
$this->sendTestException();
|
||||
}
|
||||
|
||||
protected function checkFlareKey()
|
||||
{
|
||||
$message = empty($this->config->get('flare.key'))
|
||||
? '❌ Flare key not specified. Make sure you specify a value in the `key` key of the `flare` config file.'
|
||||
: '✅ Flare key specified';
|
||||
|
||||
$this->info($message);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function checkFlareLogger()
|
||||
{
|
||||
$defaultLogChannel = $this->config->get('logging.default');
|
||||
|
||||
$activeStack = $this->config->get("logging.channels.{$defaultLogChannel}");
|
||||
|
||||
if (is_null($activeStack)) {
|
||||
$this->info("❌ The default logging channel `{$defaultLogChannel}` is not configured in the `logging` config file");
|
||||
}
|
||||
|
||||
if (! isset($activeStack['channels']) || ! in_array('flare', $activeStack['channels'])) {
|
||||
$this->info("❌ The logging channel `{$defaultLogChannel}` does not contain the 'flare' channel");
|
||||
}
|
||||
|
||||
if (is_null($this->config->get('logging.channels.flare'))) {
|
||||
$this->info('❌ There is no logging channel named `flare` in the `logging` config file');
|
||||
}
|
||||
|
||||
if ($this->config->get('logging.channels.flare.driver') !== 'flare') {
|
||||
$this->info('❌ The `flare` logging channel defined in the `logging` config file is not set to `flare`.');
|
||||
}
|
||||
|
||||
$this->info('✅ The Flare logging driver was configured correctly.');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function sendTestException()
|
||||
{
|
||||
$testException = new Exception('This is an exception to test if the integration with Flare works.');
|
||||
|
||||
try {
|
||||
app('flare.client')->sendTestReport($testException);
|
||||
$this->info(PHP_EOL);
|
||||
} catch (Exception $exception) {
|
||||
$this->warn('❌ We were unable to send an exception to Flare. Make sure that your key is correct and that you have a valid subscription. '.PHP_EOL.PHP_EOL.'For more info visit the docs on installing Flare in a Laravel project: https://flareapp.io/docs/ignition-for-laravel/introduction');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info('We tried to send an exception to Flare. Please check if it arrived!');
|
||||
}
|
||||
}
|
||||
43
vendor/facade/ignition/src/Commands/stubs/runnable-solution.stub
vendored
Normal file
43
vendor/facade/ignition/src/Commands/stubs/runnable-solution.stub
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Facade\IgnitionContracts\RunnableSolution;
|
||||
|
||||
class DummyClass implements RunnableSolution
|
||||
{
|
||||
public function getSolutionTitle(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getDocumentationLinks(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getSolutionActionDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getRunButtonText(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getSolutionDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getRunParameters(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function run(array $parameters = [])
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
23
vendor/facade/ignition/src/Commands/stubs/solution.stub
vendored
Normal file
23
vendor/facade/ignition/src/Commands/stubs/solution.stub
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Facade\IgnitionContracts\Solution;
|
||||
|
||||
class DummyClass implements Solution
|
||||
{
|
||||
public function getSolutionTitle(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getSolutionDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getDocumentationLinks(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user