From 6a910bc3e55c65a40e45e240ebb44641e3bf6d8b Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Thu, 22 Nov 2018 07:38:39 +0800 Subject: [PATCH 1/2] Update form labels to use form-label class --- src/stubs/resources/views/full/create.stub | 4 ++-- src/stubs/resources/views/full/edit.stub | 8 ++++---- src/stubs/resources/views/full/index.stub | 2 +- src/stubs/resources/views/simple/forms.stub | 12 ++++++------ src/stubs/resources/views/simple/index.stub | 2 +- tests/Generators/Simple/ViewsGeneratorTest.php | 14 +++++++------- tests/Generators/ViewsGeneratorTest.php | 14 +++++++------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/stubs/resources/views/full/create.stub b/src/stubs/resources/views/full/create.stub index 1c82f5a..26a0879 100644 --- a/src/stubs/resources/views/full/create.stub +++ b/src/stubs/resources/views/full/create.stub @@ -11,12 +11,12 @@ {{ csrf_field() }}
- + {!! $errors->first('name', ':message') !!}
- + {!! $errors->first('description', ':message') !!}
diff --git a/src/stubs/resources/views/full/edit.stub b/src/stubs/resources/views/full/edit.stub index 938b946..64a96ad 100644 --- a/src/stubs/resources/views/full/edit.stub +++ b/src/stubs/resources/views/full/edit.stub @@ -10,9 +10,9 @@
{{ __('master.delete') }}
- +

{{ $singleMstr->name }}

- +

{{ $singleMstr->description }}

{!! $errors->first('master_id', ':message') !!}
@@ -35,12 +35,12 @@ {{ csrf_field() }} {{ method_field('patch') }}
- + {!! $errors->first('name', ':message') !!}
- + {!! $errors->first('description', ':message') !!}
diff --git a/src/stubs/resources/views/full/index.stub b/src/stubs/resources/views/full/index.stub index 4ea1e9c..0baaba4 100644 --- a/src/stubs/resources/views/full/index.stub +++ b/src/stubs/resources/views/full/index.stub @@ -18,7 +18,7 @@
- +
diff --git a/src/stubs/resources/views/simple/forms.stub b/src/stubs/resources/views/simple/forms.stub index 56d36e5..ef757f0 100644 --- a/src/stubs/resources/views/simple/forms.stub +++ b/src/stubs/resources/views/simple/forms.stub @@ -3,12 +3,12 @@ {{ csrf_field() }}
- + {!! $errors->first('name', ':message') !!}
- + {!! $errors->first('description', ':message') !!}
@@ -22,12 +22,12 @@ {{ csrf_field() }} {{ method_field('patch') }}
- + {!! $errors->first('name', ':message') !!}
- + {!! $errors->first('description', ':message') !!}
@@ -46,9 +46,9 @@
{{ __('master.delete') }}
- +

{{ $editableMaster->name }}

- +

{{ $editableMaster->description }}

{!! $errors->first('master_id', ':message') !!}
diff --git a/src/stubs/resources/views/simple/index.stub b/src/stubs/resources/views/simple/index.stub index 85b766f..e94565b 100644 --- a/src/stubs/resources/views/simple/index.stub +++ b/src/stubs/resources/views/simple/index.stub @@ -18,7 +18,7 @@
- +
diff --git a/tests/Generators/Simple/ViewsGeneratorTest.php b/tests/Generators/Simple/ViewsGeneratorTest.php index 50f7476..20c4b42 100644 --- a/tests/Generators/Simple/ViewsGeneratorTest.php +++ b/tests/Generators/Simple/ViewsGeneratorTest.php @@ -34,7 +34,7 @@ class ViewsGeneratorTest extends TestCase
- + lang_name}.search_text') }}\" name=\"q\" type=\"text\" id=\"q\" class=\"form-control mx-sm-2\" value=\"{{ request('q') }}\">
lang_name}.search') }}\" class=\"btn btn-secondary\"> @@ -91,12 +91,12 @@ class ViewsGeneratorTest extends TestCase table_name}.store') }}\" accept-charset=\"UTF-8\"> {{ csrf_field() }}
- + has('name') ? ' is-invalid' : '' }}\" name=\"name\" value=\"{{ old('name') }}\" required> {!! \$errors->first('name', ':message') !!}
- + {!! \$errors->first('description', ':message') !!}
@@ -110,12 +110,12 @@ class ViewsGeneratorTest extends TestCase table_name}.update', \$editable{$this->model_name}) }}\" accept-charset=\"UTF-8\"> {{ csrf_field() }} {{ method_field('patch') }}
- + has('name') ? ' is-invalid' : '' }}\" name=\"name\" value=\"{{ old('name', \$editable{$this->model_name}->name) }}\" required> {!! \$errors->first('name', ':message') !!}
- + {!! \$errors->first('description', ':message') !!}
@@ -134,9 +134,9 @@ class ViewsGeneratorTest extends TestCase
{{ __('{$this->lang_name}.delete') }}
- +

{{ \$editable{$this->model_name}->name }}

- +

{{ \$editable{$this->model_name}->description }}

{!! \$errors->first('{$this->lang_name}_id', ':message') !!}
diff --git a/tests/Generators/ViewsGeneratorTest.php b/tests/Generators/ViewsGeneratorTest.php index 31d7507..6fa1d32 100644 --- a/tests/Generators/ViewsGeneratorTest.php +++ b/tests/Generators/ViewsGeneratorTest.php @@ -34,7 +34,7 @@ class ViewsGeneratorTest extends TestCase
- + lang_name}.search_text') }}\" name=\"q\" type=\"text\" id=\"q\" class=\"form-control mx-sm-2\" value=\"{{ request('q') }}\">
lang_name}.search') }}\" class=\"btn btn-secondary\"> @@ -132,12 +132,12 @@ class ViewsGeneratorTest extends TestCase {{ csrf_field() }}
- + has('name') ? ' is-invalid' : '' }}\" name=\"name\" value=\"{{ old('name') }}\" required> {!! \$errors->first('name', ':message') !!}
- + {!! \$errors->first('description', ':message') !!}
@@ -174,9 +174,9 @@ class ViewsGeneratorTest extends TestCase
{{ __('{$this->lang_name}.delete') }}
- +

{{ \${$this->single_model_var_name}->name }}

- +

{{ \${$this->single_model_var_name}->description }}

{!! \$errors->first('{$this->lang_name}_id', ':message') !!}
@@ -199,12 +199,12 @@ class ViewsGeneratorTest extends TestCase {{ csrf_field() }} {{ method_field('patch') }}
- + has('name') ? ' is-invalid' : '' }}\" name=\"name\" value=\"{{ old('name', \${$this->single_model_var_name}->name) }}\" required> {!! \$errors->first('name', ':message') !!}
- + {!! \$errors->first('description', ':message') !!}
From 85f22dc9c3e534d201a661292f911901402867ee Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Fri, 23 Nov 2018 20:58:32 +0800 Subject: [PATCH 2/2] Update readme for usage on fresh install Laravel --- readme.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/readme.md b/readme.md index dbe63ee..bd9cc13 100644 --- a/readme.md +++ b/readme.md @@ -114,6 +114,32 @@ Then visit our application url: `http://localhost:8000/vehicles`.
+#### Usage on Fresh Install Laravel + +If you are using this package from from the fresh laravel project. + +```bash +# This is example commands for Ubuntu users. +$ composer create-project laravel/laravel --prefer-dist project-directory +$ cd project-directory +$ vim .env # Edit your .env file to update database configuration + +# Install the package +$ composer require luthfi/simple-crud-generator --dev + +# Create auth scaffolds to get layout.app view, register and login feature +$ php artisan make:auth + +$ php artisan make:crud Vehicle # Model name in singular +# I really suggest "git commit" your project right before run make:crud command + +$ php artisan migrate +$ php artisan serve +# Visit your route http://127.0.0.1:8000 +# Register as new user +# Visit your route http://127.0.0.1:8000/vehicles +``` + #### Available Commands ```bash