Browse Source

Fix invalid delete button variable on simpe edit form

tags/1.1.7
Nafies Luthfi 7 years ago
parent
commit
0ab7b8cc2e
  1. 6
      src/stubs/resources/views/simple/forms.stub
  2. 6
      tests/Generators/Simple/ViewsGeneratorTest.php

6
src/stubs/resources/views/simple/forms.stub

@ -21,12 +21,12 @@
@endif
{!! Form::submit(__('master.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('masters.index', __('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
@can('delete', $singleMstr)
@can('delete', $editableMaster)
{!! link_to_route(
'masters.index',
__('app.delete'),
['action' => 'delete', 'id' => $singleMstr->id] + Request::only('page', 'q'),
['id' => 'del-master-'.$singleMstr->id, 'class' => 'btn btn-danger pull-right']
['action' => 'delete', 'id' => $editableMaster->id] + Request::only('page', 'q'),
['id' => 'del-master-'.$editableMaster->id, 'class' => 'btn btn-danger pull-right']
) !!}
@endcan
{!! Form::close() !!}

6
tests/Generators/Simple/ViewsGeneratorTest.php

@ -111,12 +111,12 @@ class ViewsGeneratorTest extends TestCase
@endif
{!! Form::submit(__('{$this->lang_name}.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('{$this->table_name}.index', __('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
@can('delete', \${$this->single_model_var_name})
@can('delete', \$editable{$this->model_name})
{!! link_to_route(
'{$this->table_name}.index',
__('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']
['action' => 'delete', 'id' => \$editable{$this->model_name}->id] + Request::only('page', 'q'),
['id' => 'del-{$this->lang_name}-'.\$editable{$this->model_name}->id, 'class' => 'btn btn-danger pull-right']
) !!}
@endcan
{!! Form::close() !!}

Loading…
Cancel
Save