diff --git a/src/CrudSimpleMake.php b/src/CrudSimpleMake.php index 328b47e..35b3543 100644 --- a/src/CrudSimpleMake.php +++ b/src/CrudSimpleMake.php @@ -107,7 +107,7 @@ class CrudSimpleMake extends GeneratorCommand public function generateResources() { app('Luthfi\CrudGenerator\Generators\LangFileGenerator', ['command' => $this])->generate(); - app('Luthfi\CrudGenerator\Generators\FormViewGenerator', ['command' => $this])->generate(); + app('Luthfi\CrudGenerator\Generators\FormViewGenerator', ['command' => $this])->generate('simple'); app('Luthfi\CrudGenerator\Generators\IndexViewGenerator', ['command' => $this])->generate('simple'); } } diff --git a/src/Generators/FormViewGenerator.php b/src/Generators/FormViewGenerator.php index 776e2d7..4facdc4 100644 --- a/src/Generators/FormViewGenerator.php +++ b/src/Generators/FormViewGenerator.php @@ -14,7 +14,11 @@ class FormViewGenerator extends BaseGenerator { $viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name'])); - $this->generateFile($viewPath.'/forms.blade.php', $this->getContent('view-forms')); + if ($type == 'simple') { + $this->generateFile($viewPath.'/forms.blade.php', $this->getContent('view-forms')); + } else { + $this->generateFile($viewPath.'/create.blade.php', $this->getContent('view-create')); + } $this->command->info($this->modelNames['model_name'].' form view file generated.'); } diff --git a/src/stubs/view-create.stub b/src/stubs/view-create.stub new file mode 100644 index 0000000..0f724c4 --- /dev/null +++ b/src/stubs/view-create.stub @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('title', trans('master.create')) + +@section('content') +
{{ \$editable{$this->model_name}->name }}
- -{{ \$editable{$this->model_name}->description }}
- {!! \$errors->first('{$this->lang_name}_id', ':message') !!} -