diff --git a/app/Console/Commands/formblade.dat b/app/Console/Commands/data/formblade.dat similarity index 100% rename from app/Console/Commands/formblade.dat rename to app/Console/Commands/data/formblade.dat diff --git a/app/Console/Commands/data/handle.dat b/app/Console/Commands/data/handle.dat new file mode 100644 index 0000000..ae7d4f7 --- /dev/null +++ b/app/Console/Commands/data/handle.dat @@ -0,0 +1,16 @@ +argument('part')); + $section = strtolower($this->argument('section')); + + // make detail + $detail = [ + 'name' => $part, + 'version' => '1.0', + 'author' => 'xStack', + 'email' => 'xshop@xstack.ir', + 'license' => 'GPL-3.0-or-later', + 'url' => 'https://xstack.ir', + 'author_url' => 'https://4xmen.ir', + 'packages' => [], + ]; + // check section + if (!in_array($section, Theme::$sections)) { + $this->error(__('Invalid theme section')); + return -1; + } + + + $folderPath = __DIR__ . '/../../../resources/views/theme/' . $section . '/' . $part; + + + // check is exists + if (File::exists($folderPath)) { + $this->warn(__('Command ignored, theme part exists!')); + return -1; + } + + // create folder + File::makeDirectory($folderPath, 0755, true); + File::makeDirectory($folderPath.'/assets', 0755, true); + + $this->info('Directory created as: /theme/' . $section . '/' . $part); + + $handler = file_get_contents(__DIR__.'/data/handle.dat'); + + $handler = str_replace('Handle',ucfirst($part), $handler); + $scss = <<"); + file_put_contents($folderPath . '/' . $part . '.js', ''); + file_put_contents($folderPath . '/' . $part . '.json', json_encode($detail,JSON_PRETTY_PRINT)); + file_put_contents($folderPath . '/' . ucfirst($part) . '.php', $handler); + file_put_contents($folderPath . '/' . $part . '.scss', $scss); + File::copy(__DIR__.'/data/screenshot.dat',$folderPath .'/screenshot.png'); + + + $this->info(__("Theme part created successfully: [blade, js, json, scss, php, assets, screenshot]")); + return 0; + } + + +} diff --git a/app/Console/Commands/makeXcontroller.php b/app/Console/Commands/makeXcontroller.php index a30e9b6..be0f453 100644 --- a/app/Console/Commands/makeXcontroller.php +++ b/app/Console/Commands/makeXcontroller.php @@ -21,7 +21,7 @@ class makeXcontroller extends Command * * @var string */ - protected $description = 'create new xContoller'; + protected $description = 'create new xController'; /** * Execute the console command. @@ -41,7 +41,7 @@ class makeXcontroller extends Command } // get controller content - $content = file_get_contents(__DIR__ . '/xcontroller.dat'); + $content = file_get_contents(__DIR__ . '/data/xcontroller.dat'); // replace variables $content = str_replace('User', $model, $content); @@ -77,13 +77,13 @@ class makeXcontroller extends Command // make list blade $model = strtolower($model); - $content = file_get_contents(__DIR__ . '/listblade.dat'); + $content = file_get_contents(__DIR__ . '/data/listblade.dat'); $content = str_replace('Users',$plural,$content); file_put_contents($folderPath.'/'.$model.'-list.blade.php',$content); $this->info($model.'-list.blade.php created'); // make form blade - $content = file_get_contents(__DIR__ . '/formblade.dat'); + $content = file_get_contents(__DIR__ . '/data/formblade.dat'); $content = str_replace('Users',$plural,$content); $content = str_replace('user',strtolower($model),$content); file_put_contents($folderPath.'/'.$model.'-form.blade.php',$content); diff --git a/package.json b/package.json index a14c775..1f9cbe6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "private": true, "type": "module", + "license": "GPL-3.0-or-later", "scripts": { "dev": "vite", "build": "vite build" diff --git a/resources/views/components/setting-field.blade.php b/resources/views/components/setting-field.blade.php index 57ccb31..f107457 100644 --- a/resources/views/components/setting-field.blade.php +++ b/resources/views/components/setting-field.blade.php @@ -104,5 +104,4 @@ value="{{old($setting->key, $setting->value)}}" @if($setting->ltr) dir="ltr" @endif> @endif @endswitch -