diff --git a/composer.json b/composer.json index b24753f..d462938 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "laravel", "laravel5" ], - "version": "1.0.4", + "version": "1.0.5", "authors": [ { "name": "Hyleeh", diff --git a/src/Providers/HierarchyServiceProvider.php b/src/Providers/HierarchyServiceProvider.php index fce0cad..e8618e4 100644 --- a/src/Providers/HierarchyServiceProvider.php +++ b/src/Providers/HierarchyServiceProvider.php @@ -8,7 +8,7 @@ class HierarchyServiceProvider extends ServiceProvider { - const version = '1.0.4'; + const version = '1.0.5'; /** * Register the service provider. diff --git a/src/Support/helpers.php b/src/Support/helpers.php index a71e917..32ab41a 100644 --- a/src/Support/helpers.php +++ b/src/Support/helpers.php @@ -40,6 +40,6 @@ function source_model_name($key) */ function source_form_name($key) { - return 'CreateEdit' . ucfirst($key) . 'Form'; + return 'Edit' . ucfirst($key) . 'Form'; } } \ No newline at end of file diff --git a/src/Support/templates/entities/form.blade.php b/src/Support/templates/entities/form.blade.php index 3e924f6..beaa1a6 100644 --- a/src/Support/templates/entities/form.blade.php +++ b/src/Support/templates/entities/form.blade.php @@ -10,7 +10,7 @@ class {{ $name }} extends Form { public function buildForm() { - $this->compose('Nuclear\Hierarchy\Http\Forms\NodeSourceForm'); + $this->compose(new \Nuclear\Hierarchy\Http\Forms\NodeSourceForm); @foreach($fields as $field) $this->add('{{ $field->name }}', '{{ $field->type }}', [ 'label' => '{{ $field->label }}', diff --git a/tests/Builders/FormBuilderTest.php b/tests/Builders/FormBuilderTest.php index af9fbe1..ca25770 100644 --- a/tests/Builders/FormBuilderTest.php +++ b/tests/Builders/FormBuilderTest.php @@ -91,7 +91,7 @@ function it_returns_the_class_name() $builder = $this->getBuilder(); $this->assertEquals( - 'CreateEditProjectForm', + 'EditProjectForm', $builder->getClassName('project') ); } @@ -113,7 +113,7 @@ function it_returns_the_class_path() $builder = $this->getBuilder(); $this->assertEquals( - generated_path() . '/Forms/CreateEditProjectForm.php', + generated_path() . '/Forms/EditProjectForm.php', $builder->getClassFilePath('project') ); } diff --git a/tests/Support/HelpersTest.php b/tests/Support/HelpersTest.php index 6589a59..10dc248 100644 --- a/tests/Support/HelpersTest.php +++ b/tests/Support/HelpersTest.php @@ -24,7 +24,7 @@ function it_registers_source_model_name_helpers() function it_registers_source_form_name_helpers() { $this->assertEquals( - 'CreateEditProjectForm', + 'EditProjectForm', source_form_name('project') ); } diff --git a/tests/_stubs/entities/form.php b/tests/_stubs/entities/form.php index dc46b80..9f1deb9 100644 --- a/tests/_stubs/entities/form.php +++ b/tests/_stubs/entities/form.php @@ -5,11 +5,11 @@ use Kris\LaravelFormBuilder\Form; -class CreateEditCategoryForm extends Form { +class EditCategoryForm extends Form { public function buildForm() { - $this->compose('Nuclear\Hierarchy\Http\Forms\NodeSourceForm'); + $this->compose(new \Nuclear\Hierarchy\Http\Forms\NodeSourceForm); } } \ No newline at end of file