image filter generator

This commit is contained in:
2026-05-18 18:38:43 +03:00
parent f74c850e01
commit f1a0d6a2b1
+7 -3
View File
@@ -3,6 +3,7 @@
namespace Lucent\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class GenerateImageFilter extends Command
{
@@ -20,7 +21,10 @@ class GenerateImageFilter extends Command
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)) {
$this->error("Filter {$name} already exists at {$filePath}");
@@ -35,7 +39,7 @@ class GenerateImageFilter extends Command
use Lucent\ImageFilterInterface;
use Intervention\Image\Interfaces\ImageInterface;
class {$name} implements ImageFilterInterface
class {$className} implements ImageFilterInterface
{
public function apply(ImageInterface \$image): ImageInterface
{
@@ -47,7 +51,7 @@ class GenerateImageFilter extends Command
}
public function getPath(): string {
return "{$name}";
return "{$pathName}";
}
}
PHP;