From 7563d5ff82b1d885f402e9830e53096c895d1dce Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Wed, 13 Dec 2017 12:40:01 +0800 Subject: [PATCH] Add support for php >=5.6.4 and laravel 5.3 --- composer.json | 4 ++-- src/stubs/route-web.stub | 2 +- src/stubs/view-index.stub | 4 +++- tests/Generators/RouteWebGeneratorTest.php | 4 ++-- tests/Generators/ViewsGeneratorTest.php | 6 ++++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index e9e5670..a1eb721 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ } }, "require": { - "php": ">=7.0", - "illuminate/support": "5.4.* || 5.5.*", + "php": ">=5.6.4", + "illuminate/support": "5.3.* || 5.4.* || 5.5.*", "laravel/browser-kit-testing": "^2.0" }, "require-dev": { diff --git a/src/stubs/route-web.stub b/src/stubs/route-web.stub index edd9fd5..a14f14b 100644 --- a/src/stubs/route-web.stub +++ b/src/stubs/route-web.stub @@ -1,2 +1,2 @@ -Route::apiResource('masters', 'MastersController'); +Route::resource('masters', 'MastersController'); diff --git a/src/stubs/view-index.stub b/src/stubs/view-index.stub index 8b66687..ff31c1a 100644 --- a/src/stubs/view-index.stub +++ b/src/stubs/view-index.stub @@ -57,7 +57,9 @@
- @includeWhen(Request::has('action'), 'masters.forms') + @if(Request::has('action')) + @include('masters.forms') + @endif
@endsection diff --git a/tests/Generators/RouteWebGeneratorTest.php b/tests/Generators/RouteWebGeneratorTest.php index 446eddf..33ce545 100644 --- a/tests/Generators/RouteWebGeneratorTest.php +++ b/tests/Generators/RouteWebGeneratorTest.php @@ -15,7 +15,7 @@ class RouteWebGeneratorTest extends TestCase $this->assertFileExists($routeWebPath); $routeWebFileContent = "table_name}', '{$this->plural_model_name}Controller'); +Route::resource('{$this->table_name}', '{$this->plural_model_name}Controller'); "; $this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath)); } @@ -29,7 +29,7 @@ Route::apiResource('{$this->table_name}', '{$this->plural_model_name}Controller' $this->assertFileExists($routeWebPath); $routeWebFileContent = "table_name}', 'Projects\\{$this->plural_model_name}Controller'); +Route::resource('{$this->table_name}', 'Projects\\{$this->plural_model_name}Controller'); "; $this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath)); } diff --git a/tests/Generators/ViewsGeneratorTest.php b/tests/Generators/ViewsGeneratorTest.php index 5ba6ec6..a972d48 100644 --- a/tests/Generators/ViewsGeneratorTest.php +++ b/tests/Generators/ViewsGeneratorTest.php @@ -73,7 +73,9 @@ class ViewsGeneratorTest extends TestCase
- @includeWhen(Request::has('action'), '{$this->table_name}.forms') + @if(Request::has('action')) + @include('{$this->table_name}.forms') + @endif
@endsection @@ -162,7 +164,7 @@ class ViewsGeneratorTest extends TestCase public function generateDefaultLayoutView($defaultLayoutView) { $dataViewPathArray = explode('.', $defaultLayoutView); - $fileName = array_pop($dataViewPathArray); + $fileName = array_pop($dataViewPathArray); $defaultLayoutPath = resource_path('views/'.implode('/', $dataViewPathArray)); $files = app('Illuminate\Filesystem\Filesystem');