Skip to content

Commit

Permalink
Add command "make:filter"
Browse files Browse the repository at this point in the history
  • Loading branch information
maksa988 committed Jun 25, 2019
1 parent 82d6041 commit 6481d6d
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/Console/FilterMakeCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Maksa988\LaravelFilters\Console;

use Illuminate\Console\GeneratorCommand;

class FilterMakeCommand extends GeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:filter';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new filter class';

/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Filter';

/**
* Get the stub file for the generator.
*
* @return string
*/
protected function getStub()
{
return __DIR__.'/stubs/filter.stub';
}

/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Filters';
}
}
19 changes: 19 additions & 0 deletions src/Console/stubs/filter.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace DummyNamespace;

use Maksa988\LaravelFilters\Filters;

class DummyClass extends Filters
{
/**
* Available filters
*
* @var array
*/
protected $filters = [
//
];

//
}
21 changes: 21 additions & 0 deletions src/LaravelFiltersServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Maksa988\LaravelFilters;

use Illuminate\Support\ServiceProvider;
use Maksa988\LaravelFilters\Console\FilterMakeCommand;

class LaravelFiltersServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->commands([
FilterMakeCommand::class
]);
}
}

0 comments on commit 6481d6d

Please sign in to comment.