image filter generator
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace Lucent\Commands;
|
namespace Lucent\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class GenerateImageFilter extends Command
|
class GenerateImageFilter extends Command
|
||||||
{
|
{
|
||||||
@@ -20,7 +21,10 @@ class GenerateImageFilter extends Command
|
|||||||
mkdir($dir, 0755, true);
|
mkdir($dir, 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filePath = "{$dir}/{$name}.php";
|
$className = Str::of($name)->camel()->ucfirst() . "ImageFilter";
|
||||||
|
$pathName = Str::of($name)->snake()->lower();
|
||||||
|
|
||||||
|
$filePath = "{$dir}/{$className}.php";
|
||||||
|
|
||||||
if (file_exists($filePath)) {
|
if (file_exists($filePath)) {
|
||||||
$this->error("Filter {$name} already exists at {$filePath}");
|
$this->error("Filter {$name} already exists at {$filePath}");
|
||||||
@@ -35,7 +39,7 @@ class GenerateImageFilter extends Command
|
|||||||
use Lucent\ImageFilterInterface;
|
use Lucent\ImageFilterInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class {$name} implements ImageFilterInterface
|
class {$className} implements ImageFilterInterface
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface \$image): ImageInterface
|
public function apply(ImageInterface \$image): ImageInterface
|
||||||
{
|
{
|
||||||
@@ -47,7 +51,7 @@ class GenerateImageFilter extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPath(): string {
|
public function getPath(): string {
|
||||||
return "{$name}";
|
return "{$pathName}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PHP;
|
PHP;
|
||||||
|
|||||||
Reference in New Issue
Block a user