Skip to content

Commit

Permalink
Adding range filter command to artisan
Browse files Browse the repository at this point in the history
Signed-off-by: Hicham SADDEK <h.saddek@serrahub.com>
  • Loading branch information
hicham-saddek committed Jun 22, 2021
1 parent ebe7ab9 commit c6f7ed1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/Console/MakeRangeFilterCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php


namespace Milebits\Eloquent\Filters\Console;


/**
* Class MakeRangeFilterCommand
* @package Milebits\Eloquent\Filters\Console
*/
class MakeRangeFilterCommand extends MakeFilterCommand
{
protected ?string $stub = null;

/**
* MakeFilterCommand constructor.
*/
public function __construct()
{
$this->description = "Create a new eloquent model range filter for requests.";
$this->signature = "make:filter-range {filter}";
$this->stub = $this->resolveFullyQualifiedPath(__DIR__ . "/../../stubs/ModelRangeFilter.php.stub");
parent::__construct();
}
}
4 changes: 2 additions & 2 deletions src/Providers/EloquentFiltersServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Milebits\Eloquent\Filters\Providers;

use Illuminate\Support\ServiceProvider;
use Milebits\Eloquent\Filters\Console\MakeFilterCommand;
use Milebits\Eloquent\Filters\Console\MakeRangeFilterCommand;

/**
* Class EloquentFiltersServiceProvider
Expand All @@ -14,6 +14,6 @@ class EloquentFiltersServiceProvider extends ServiceProvider
public function boot()
{
if ($this->app->runningInConsole())
$this->commands([MakeFilterCommand::class]);
$this->commands([MakeRangeFilterCommand::class]);
}
}

0 comments on commit c6f7ed1

Please sign in to comment.