diff --git a/src/stubs/test-feature-simple.stub b/src/stubs/test-feature-simple.stub
index 2daeb30..63723f5 100644
--- a/src/stubs/test-feature-simple.stub
+++ b/src/stubs/test-feature-simple.stub
@@ -71,7 +71,7 @@ class ManageMastersTest extends TestCase
$this->loginAsUser();
$singleMstr = factory(Master::class)->create();
- $this->visit(route('masters.index', [$singleMstr->id]));
+ $this->visit(route('masters.index', ['action' => 'edit', 'id' => $singleMstr->id]));
$this->click('del-master-'.$singleMstr->id);
$this->seePageIs(route('masters.index', ['action' => 'delete', 'id' => $singleMstr->id]));
diff --git a/src/stubs/view-forms.stub b/src/stubs/view-forms.stub
index 415d5d4..f04edc2 100644
--- a/src/stubs/view-forms.stub
+++ b/src/stubs/view-forms.stub
@@ -21,6 +21,14 @@
@endif
{!! Form::submit(trans('master.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
+ @can('delete', $singleMstr)
+ {!! link_to_route(
+ 'masters.index',
+ trans('app.delete'),
+ ['action' => 'delete', 'id' => $singleMstr->id] + Request::only('page', 'q'),
+ ['id' => 'del-master-'.$singleMstr->id, 'class' => 'btn btn-danger pull-right']
+ ) !!}
+ @endcan
{!! Form::close() !!}
@endcan
@endif
diff --git a/src/stubs/view-index-simple.stub b/src/stubs/view-index-simple.stub
index 11272f3..12c2ba5 100644
--- a/src/stubs/view-index-simple.stub
+++ b/src/stubs/view-index-simple.stub
@@ -38,22 +38,14 @@
{{ $singleMstr->name }} |
{{ $singleMstr->description }} |
- @can('update', $singleMstr)
- {!! link_to_route(
- 'masters.index',
- trans('app.edit'),
- ['action' => 'edit', 'id' => $singleMstr->id] + Request::only('page', 'q'),
- ['id' => 'edit-master-'.$singleMstr->id]
- ) !!} |
- @endcan
- @can('delete', $singleMstr)
- {!! link_to_route(
- 'masters.index',
- trans('app.delete'),
- ['action' => 'delete', 'id' => $singleMstr->id] + Request::only('page', 'q'),
- ['id' => 'del-master-'.$singleMstr->id]
- ) !!}
- @endcan
+ @can('update', $singleMstr)
+ {!! link_to_route(
+ 'masters.index',
+ trans('app.edit'),
+ ['action' => 'edit', 'id' => $singleMstr->id] + Request::only('page', 'q'),
+ ['id' => 'edit-master-'.$singleMstr->id]
+ ) !!}
+ @endcan
|
@endforeach
diff --git a/tests/Generators/Simple/FeatureTestGeneratorTest.php b/tests/Generators/Simple/FeatureTestGeneratorTest.php
index b198797..9a33deb 100644
--- a/tests/Generators/Simple/FeatureTestGeneratorTest.php
+++ b/tests/Generators/Simple/FeatureTestGeneratorTest.php
@@ -127,7 +127,7 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->loginAsUser();
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create();
- \$this->visit(route('{$this->table_name}.index', [\${$this->single_model_var_name}->id]));
+ \$this->visit(route('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id]));
\$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id);
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'delete', 'id' => \${$this->single_model_var_name}->id]));
@@ -276,7 +276,7 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->loginAsUser();
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create();
- \$this->visit(route('{$this->table_name}.index', [\${$this->single_model_var_name}->id]));
+ \$this->visit(route('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id]));
\$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id);
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'delete', 'id' => \${$this->single_model_var_name}->id]));
diff --git a/tests/Generators/Simple/ViewsGeneratorTest.php b/tests/Generators/Simple/ViewsGeneratorTest.php
index 5581e3b..ce25d88 100644
--- a/tests/Generators/Simple/ViewsGeneratorTest.php
+++ b/tests/Generators/Simple/ViewsGeneratorTest.php
@@ -2,8 +2,8 @@
namespace Tests\Generators\Simple;
-use Illuminate\Contracts\Console\Kernel;
use Tests\TestCase;
+use Illuminate\Contracts\Console\Kernel;
class ViewsGeneratorTest extends TestCase
{
@@ -54,22 +54,14 @@ class ViewsGeneratorTest extends TestCase
{{ \${$this->single_model_var_name}->name }} |
{{ \${$this->single_model_var_name}->description }} |
- @can('update', \${$this->single_model_var_name})
- {!! link_to_route(
- '{$this->table_name}.index',
- trans('app.edit'),
- ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id] + Request::only('page', 'q'),
- ['id' => 'edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id]
- ) !!} |
- @endcan
- @can('delete', \${$this->single_model_var_name})
- {!! link_to_route(
- '{$this->table_name}.index',
- trans('app.delete'),
- ['action' => 'delete', 'id' => \${$this->single_model_var_name}->id] + Request::only('page', 'q'),
- ['id' => 'del-{$this->lang_name}-'.\${$this->single_model_var_name}->id]
- ) !!}
- @endcan
+ @can('update', \${$this->single_model_var_name})
+ {!! link_to_route(
+ '{$this->table_name}.index',
+ trans('app.edit'),
+ ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id] + Request::only('page', 'q'),
+ ['id' => 'edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id]
+ ) !!}
+ @endcan
|
@endforeach
@@ -119,6 +111,14 @@ class ViewsGeneratorTest extends TestCase
@endif
{!! Form::submit(trans('{$this->lang_name}.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('{$this->table_name}.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
+ @can('delete', \${$this->single_model_var_name})
+ {!! link_to_route(
+ '{$this->table_name}.index',
+ trans('app.delete'),
+ ['action' => 'delete', 'id' => \${$this->single_model_var_name}->id] + Request::only('page', 'q'),
+ ['id' => 'del-{$this->lang_name}-'.\${$this->single_model_var_name}->id, 'class' => 'btn btn-danger pull-right']
+ ) !!}
+ @endcan
{!! Form::close() !!}
@endcan
@endif