for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BestServedCold\LaravelZendSearch\Laravel\Console;
use Illuminate\Console\Command;
use Illuminate\Config\Repository;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\App;
/**
* Class ClearCommand
* @package BestServedCold\LaravelZendSearch\Laravel\Console
*/
class Destroy extends Command
{
protected $name = 'search:destroy';
protected $description = 'Destroys the search index.';
public function handle()
$config = App::make(Repository::class);
$indexPath = $config->get('search.index.path');
$this->info('Destroying the search index.');
if (File::isDirectory($indexPath)) {
File::deleteDirectory($indexPath);
$this->info('Search index is destroyed.');
} else {
$this->comment('There was nothing to destroy? Try a rebuild.');
}