diff --git a/src/stubs/resources/views/full/create-formfield.stub b/src/stubs/resources/views/full/create-formfield.stub new file mode 100644 index 0000000..b4f2704 --- /dev/null +++ b/src/stubs/resources/views/full/create-formfield.stub @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('title', __('master.create')) + +@section('content') +
+
+
+

{{ __('master.create') }}

+ {!! Form::open(['route' => 'masters.store']) !!} +
+ {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} + {!! FormField::textarea('description', ['label' => __('master.description')]) !!} +
+ + {!! Form::close() !!} +
+
+
+@endsection diff --git a/src/stubs/resources/views/full/create.stub b/src/stubs/resources/views/full/create.stub index b4f2704..27e585d 100644 --- a/src/stubs/resources/views/full/create.stub +++ b/src/stubs/resources/views/full/create.stub @@ -7,16 +7,25 @@

{{ __('master.create') }}

- {!! Form::open(['route' => 'masters.store']) !!} -
- {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} - {!! FormField::textarea('description', ['label' => __('master.description')]) !!} -
- - {!! Form::close() !!} +
+ {{ csrf_field() }} +
+
+ + + {!! $errors->first('name', ':message') !!} +
+
+ + + {!! $errors->first('description', ':message') !!} +
+
+ +
diff --git a/src/stubs/resources/views/full/edit-formfield.stub b/src/stubs/resources/views/full/edit-formfield.stub new file mode 100644 index 0000000..d23de5b --- /dev/null +++ b/src/stubs/resources/views/full/edit-formfield.stub @@ -0,0 +1,56 @@ +@extends('layouts.app') + +@section('title', __('master.edit')) + +@section('content') +
+
+ @if (request('action') == 'delete' && $singleMstr) + @can('delete', $singleMstr) +
+

{{ __('master.delete') }}

+
+ +

{{ $singleMstr->name }}

+ +

{{ $singleMstr->description }}

+ {!! $errors->first('master_id', ':message') !!} +
+
+
{{ __('master.delete_confirm') }}
+ +
+ @endcan + @else +
+

{{ __('master.edit') }}

+ {!! Form::model($singleMstr, ['route' => ['masters.update', $singleMstr],'method' => 'patch']) !!} +
+ {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} + {!! FormField::textarea('description', ['label' => __('master.description')]) !!} +
+ + {!! Form::close() !!} +
+
+
+@endif +@endsection diff --git a/src/stubs/resources/views/full/edit.stub b/src/stubs/resources/views/full/edit.stub index d23de5b..4b96353 100644 --- a/src/stubs/resources/views/full/edit.stub +++ b/src/stubs/resources/views/full/edit.stub @@ -19,36 +19,42 @@
{{ __('master.delete_confirm') }}
@endcan @else

{{ __('master.edit') }}

- {!! Form::model($singleMstr, ['route' => ['masters.update', $singleMstr],'method' => 'patch']) !!} -
- {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} - {!! FormField::textarea('description', ['label' => __('master.description')]) !!} -
- - {!! Form::close() !!} +
+ {{ csrf_field() }} {{ method_field('patch') }} +
+
+ + + {!! $errors->first('name', ':message') !!} +
+
+ + + {!! $errors->first('description', ':message') !!} +
+
+ +
diff --git a/src/stubs/resources/views/full/index-formfield.stub b/src/stubs/resources/views/full/index-formfield.stub new file mode 100644 index 0000000..a10b0a0 --- /dev/null +++ b/src/stubs/resources/views/full/index-formfield.stub @@ -0,0 +1,58 @@ +@extends('layouts.app') + +@section('title', __('master.list')) + +@section('content') +

+
+ @can('create', new fullMstr) + {{ link_to_route('masters.create', __('master.create'), [], ['class' => 'btn btn-success']) }} + @endcan +
+ {{ __('master.list') }} + {{ __('app.total') }} : {{ $mstrCollections->total() }} {{ __('master.master') }} +

+
+
+
+
+ {{ Form::open(['method' => 'get','class' => 'form-inline']) }} + {!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} + {{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} + {{ link_to_route('masters.index', __('app.reset')) }} + {{ Form::close() }} +
+ + + + + + + + + + + @foreach($mstrCollections as $key => $singleMstr) + + + + + + + @endforeach + +
{{ __('app.table_no') }}{{ __('master.name') }}{{ __('master.description') }}{{ __('app.action') }}
{{ $mstrCollections->firstItem() + $key }}{{ $singleMstr->name_link }}{{ $singleMstr->description }} + @can('view', $singleMstr) + {!! link_to_route( + 'masters.show', + __('app.show'), + [$singleMstr], + ['class' => 'btn btn-default btn-xs', 'id' => 'show-master-' . $singleMstr->id] + ) !!} + @endcan +
+
{{ $mstrCollections->appends(Request::except('page'))->render() }}
+
+
+
+@endsection diff --git a/src/stubs/resources/views/full/index.stub b/src/stubs/resources/views/full/index.stub index a10b0a0..4449dc1 100644 --- a/src/stubs/resources/views/full/index.stub +++ b/src/stubs/resources/views/full/index.stub @@ -6,7 +6,7 @@

@can('create', new fullMstr) - {{ link_to_route('masters.create', __('master.create'), [], ['class' => 'btn btn-success']) }} + {{ __('master.create') }} @endcan
{{ __('master.list') }} @@ -16,11 +16,14 @@
- {{ Form::open(['method' => 'get','class' => 'form-inline']) }} - {!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} - {{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} - {{ link_to_route('masters.index', __('app.reset')) }} - {{ Form::close() }} +
+
+ + +
+ + Reset +
@@ -39,12 +42,7 @@ diff --git a/src/stubs/resources/views/full/show-formfield.stub b/src/stubs/resources/views/full/show-formfield.stub new file mode 100644 index 0000000..d115485 --- /dev/null +++ b/src/stubs/resources/views/full/show-formfield.stub @@ -0,0 +1,25 @@ +@extends('layouts.app') + +@section('title', __('master.detail')) + +@section('content') +
+
+
+

{{ __('master.detail') }}

+
{{ $singleMstr->description }} @can('view', $singleMstr) - {!! link_to_route( - 'masters.show', - __('app.show'), - [$singleMstr], - ['class' => 'btn btn-default btn-xs', 'id' => 'show-master-' . $singleMstr->id] - ) !!} + {{ __('app.show') }} @endcan
+ + + + +
{{ __('master.name') }}{{ $singleMstr->name }}
{{ __('master.description') }}{{ $singleMstr->description }}
+ +
+
+ +@endsection diff --git a/src/stubs/resources/views/full/show.stub b/src/stubs/resources/views/full/show.stub index d115485..c391b93 100644 --- a/src/stubs/resources/views/full/show.stub +++ b/src/stubs/resources/views/full/show.stub @@ -15,9 +15,9 @@ diff --git a/src/stubs/resources/views/simple/forms-formfield.stub b/src/stubs/resources/views/simple/forms-formfield.stub new file mode 100644 index 0000000..2d3f4fb --- /dev/null +++ b/src/stubs/resources/views/simple/forms-formfield.stub @@ -0,0 +1,63 @@ +@if (Request::get('action') == 'create') +@can('create', new fullMstr) + {{ Form::open(['route' => 'masters.store']) }} + {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} + {!! FormField::textarea('description', ['label' => __('master.description')]) !!} + {{ Form::submit(__('master.create'), ['class' => 'btn btn-success']) }} + {{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }} + {{ Form::close() }} +@endcan +@endif +@if (Request::get('action') == 'edit' && $editableMaster) +@can('update', $editableMaster) + {{ Form::model($editableMaster, ['route' => ['masters.update', $editableMaster], 'method' => 'patch']) }} + {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} + {!! FormField::textarea('description', ['label' => __('master.description')]) !!} + @if (request('q')) + {{ Form::hidden('q', request('q')) }} + @endif + @if (request('page')) + {{ Form::hidden('page', request('page')) }} + @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', $editableMaster) + {{ link_to_route( + 'masters.index', + __('app.delete'), + ['action' => 'delete', 'id' => $editableMaster->id] + Request::only('page', 'q'), + ['id' => 'del-master-'.$editableMaster->id, 'class' => 'btn btn-danger pull-right'] + ) }} + @endcan + {{ Form::close() }} +@endcan +@endif +@if (Request::get('action') == 'delete' && $editableMaster) +@can('delete', $editableMaster) +
+

{{ __('master.delete') }}

+
+ +

{{ $editableMaster->name }}

+ +

{{ $editableMaster->description }}

+ {!! $errors->first('master_id', ':message') !!} +
+
+
{{ __('master.delete_confirm') }}
+ +
+@endcan +@endif diff --git a/src/stubs/resources/views/simple/forms.stub b/src/stubs/resources/views/simple/forms.stub index a98cdc3..5a3236d 100644 --- a/src/stubs/resources/views/simple/forms.stub +++ b/src/stubs/resources/views/simple/forms.stub @@ -1,35 +1,44 @@ @if (Request::get('action') == 'create') @can('create', new fullMstr) - {!! Form::open(['route' => 'masters.store']) !!} - {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} - {!! FormField::textarea('description', ['label' => __('master.description')]) !!} - {!! Form::submit(__('master.create'), ['class' => 'btn btn-success']) !!} - {{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }} - {!! Form::close() !!} +
+ {{ csrf_field() }} +
+ + + {!! $errors->first('name', ':message') !!} +
+
+ + + {!! $errors->first('description', ':message') !!} +
+ + {{ __('app.cancel') }} +
@endcan @endif @if (Request::get('action') == 'edit' && $editableMaster) @can('update', $editableMaster) - {!! Form::model($editableMaster, ['route' => ['masters.update', $editableMaster], 'method' => 'patch']) !!} - {!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} - {!! FormField::textarea('description', ['label' => __('master.description')]) !!} - @if (request('q')) - {{ Form::hidden('q', request('q')) }} - @endif - @if (request('page')) - {{ Form::hidden('page', request('page')) }} - @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', $editableMaster) - {!! link_to_route( - 'masters.index', - __('app.delete'), - ['action' => 'delete', 'id' => $editableMaster->id] + Request::only('page', 'q'), - ['id' => 'del-master-'.$editableMaster->id, 'class' => 'btn btn-danger pull-right'] - ) !!} - @endcan - {!! Form::close() !!} +
+ {{ csrf_field() }} {{ method_field('patch') }} +
+ + + {!! $errors->first('name', ':message') !!} +
+
+ + + {!! $errors->first('description', ':message') !!} +
+ + + + {{ __('app.cancel') }} + @can('delete', $editableMaster) + {{ __('app.delete') }} + @endcan +
@endcan @endif @if (Request::get('action') == 'delete' && $editableMaster) @@ -46,17 +55,14 @@
{{ __('master.delete_confirm') }}
@endcan diff --git a/src/stubs/resources/views/simple/index-formfield.stub b/src/stubs/resources/views/simple/index-formfield.stub new file mode 100644 index 0000000..b602cbe --- /dev/null +++ b/src/stubs/resources/views/simple/index-formfield.stub @@ -0,0 +1,63 @@ +@extends('layouts.app') + +@section('title', __('master.list')) + +@section('content') +

+
+ @can('create', new fullMstr) + {{ link_to_route('masters.index', __('master.create'), ['action' => 'create'], ['class' => 'btn btn-success']) }} + @endcan +
+ {{ __('master.list') }} + {{ __('app.total') }} : {{ $mstrCollections->total() }} {{ __('master.master') }} +

+
+
+
+
+ {{ Form::open(['method' => 'get', 'class' => 'form-inline']) }} + {!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} + {{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} + {{ link_to_route('masters.index', __('app.reset')) }} + {{ Form::close() }} +
+ + + + + + + + + + + @foreach($mstrCollections as $key => $singleMstr) + + + + + + + @endforeach + +
{{ __('app.table_no') }}{{ __('master.name') }}{{ __('master.description') }}{{ __('app.action') }}
{{ $mstrCollections->firstItem() + $key }}{{ $singleMstr->name }}{{ $singleMstr->description }} + @can('update', $singleMstr) + {!! link_to_route( + 'masters.index', + __('app.edit'), + ['action' => 'edit', 'id' => $singleMstr->id] + Request::only('page', 'q'), + ['id' => 'edit-master-'.$singleMstr->id] + ) !!} + @endcan +
+
{{ $mstrCollections->appends(Request::except('page'))->render() }}
+
+
+
+ @if(Request::has('action')) + @include('masters.forms') + @endif +
+
+@endsection diff --git a/src/stubs/resources/views/simple/index.stub b/src/stubs/resources/views/simple/index.stub index b602cbe..561daca 100644 --- a/src/stubs/resources/views/simple/index.stub +++ b/src/stubs/resources/views/simple/index.stub @@ -6,7 +6,7 @@

@can('create', new fullMstr) - {{ link_to_route('masters.index', __('master.create'), ['action' => 'create'], ['class' => 'btn btn-success']) }} + {{ __('master.create') }} @endcan
{{ __('master.list') }} @@ -16,11 +16,14 @@
- {{ Form::open(['method' => 'get', 'class' => 'form-inline']) }} - {!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} - {{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} - {{ link_to_route('masters.index', __('app.reset')) }} - {{ Form::close() }} +
+
+ + +
+ + Reset +
@@ -39,12 +42,7 @@ diff --git a/tests/Generators/Simple/ViewsGeneratorTest.php b/tests/Generators/Simple/ViewsGeneratorTest.php index 1fed9e6..3472c08 100644 --- a/tests/Generators/Simple/ViewsGeneratorTest.php +++ b/tests/Generators/Simple/ViewsGeneratorTest.php @@ -22,7 +22,7 @@ class ViewsGeneratorTest extends TestCase

@can('create', new {$this->full_model_name}) - {{ link_to_route('{$this->table_name}.index', __('{$this->lang_name}.create'), ['action' => 'create'], ['class' => 'btn btn-success']) }} + table_name}.index', ['action' => 'create']) }}\" class=\"btn btn-success\">{{ __('{$this->lang_name}.create') }} @endcan
{{ __('{$this->lang_name}.list') }} @@ -32,11 +32,14 @@ class ViewsGeneratorTest extends TestCase
- {{ Form::open(['method' => 'get', 'class' => 'form-inline']) }} - {!! FormField::text('q', ['label' => __('{$this->lang_name}.search'), 'placeholder' => __('{$this->lang_name}.search_text'), 'class' => 'input-sm']) !!} - {{ Form::submit(__('{$this->lang_name}.search'), ['class' => 'btn btn-sm']) }} - {{ link_to_route('{$this->table_name}.index', __('app.reset')) }} - {{ Form::close() }} +
+
+ + lang_name}.search_text') }}\" name=\"q\" type=\"text\" id=\"q\" class=\"form-control input-sm\" value=\"{{ request('q') }}\"> +
+ lang_name}.search') }}\" class=\"btn btn-sm\"> + table_name}.index') }}\">Reset +

{{ $singleMstr->description }} @can('update', $singleMstr) - {!! link_to_route( - 'masters.index', - __('app.edit'), - ['action' => 'edit', 'id' => $singleMstr->id] + Request::only('page', 'q'), - ['id' => 'edit-master-'.$singleMstr->id] - ) !!} + {{ __('app.edit') }} @endcan
@@ -55,12 +58,7 @@ class ViewsGeneratorTest extends TestCase @@ -90,36 +88,45 @@ class ViewsGeneratorTest extends TestCase $this->assertFileExists($formViewPath); $formViewContent = "@if (Request::get('action') == 'create') @can('create', new {$this->full_model_name}) - {!! Form::open(['route' => '{$this->table_name}.store']) !!} - {!! FormField::text('name', ['required' => true, 'label' => __('{$this->lang_name}.name')]) !!} - {!! FormField::textarea('description', ['label' => __('{$this->lang_name}.description')]) !!} - {!! Form::submit(__('{$this->lang_name}.create'), ['class' => 'btn btn-success']) !!} - {{ link_to_route('{$this->table_name}.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }} - {!! Form::close() !!} + table_name}.store') }}\" accept-charset=\"UTF-8\"> + {{ csrf_field() }} +
has('name') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('name', ':message') !!} +
+
has('description') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('description', ':message') !!} +
+ lang_name}.create') }}\" class=\"btn btn-success\"> + table_name}.index') }}\" class=\"btn btn-default\">{{ __('app.cancel') }} + @endcan @endif @if (Request::get('action') == 'edit' && \$editable{$this->model_name}) @can('update', \$editable{$this->model_name}) - {!! Form::model(\$editable{$this->model_name}, ['route' => ['{$this->table_name}.update', \$editable{$this->model_name}], 'method' => 'patch']) !!} - {!! FormField::text('name', ['required' => true, 'label' => __('{$this->lang_name}.name')]) !!} - {!! FormField::textarea('description', ['label' => __('{$this->lang_name}.description')]) !!} - @if (request('q')) - {{ Form::hidden('q', request('q')) }} - @endif - @if (request('page')) - {{ Form::hidden('page', request('page')) }} - @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', \$editable{$this->model_name}) - {!! link_to_route( - '{$this->table_name}.index', - __('app.delete'), - ['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() !!} + table_name}.update', \$editable{$this->model_name}) }}\" accept-charset=\"UTF-8\"> + {{ csrf_field() }} {{ method_field('patch') }} +
has('name') ? ' has-error' : '' }}\"> + + model_name}->name) }}\" required> + {!! \$errors->first('name', ':message') !!} +
+
has('description') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('description', ':message') !!} +
+ + + lang_name}.update') }}\" class=\"btn btn-success\"> + table_name}.show', \$editable{$this->model_name}) }}\" class=\"btn btn-default\">{{ __('app.cancel') }} + @can('delete', \$editable{$this->model_name}) + table_name}.index', ['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\">{{ __('app.delete') }} + @endcan + @endcan @endif @if (Request::get('action') == 'delete' && \$editable{$this->model_name}) @@ -136,17 +143,14 @@ class ViewsGeneratorTest extends TestCase
{{ __('{$this->lang_name}.delete_confirm') }}
- {!! FormField::delete( - ['route' => ['{$this->table_name}.destroy', \$editable{$this->model_name}]], - __('app.delete_confirm_button'), - ['class'=>'btn btn-danger'], - [ - '{$this->lang_name}_id' => \$editable{$this->model_name}->id, - 'page' => request('page'), - 'q' => request('q'), - ] - ) !!} - {{ link_to_route('{$this->table_name}.index', __('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }} +
table_name}.destroy', \$editable{$this->model_name}) }}\" accept-charset=\"UTF-8\" onsubmit=\"return confirm("Are you sure to delete this?")\" class=\"del-form pull-right\" style=\"display: inline;\"> + {{ csrf_field() }} {{ method_field('delete') }} + lang_name}_id\" type=\"hidden\" value=\"{{ \$editable{$this->model_name}->id }}\"> + + + + + table_name}.index', [\$editable{$this->model_name}] + Request::only('page', 'q')) }}\" class=\"btn btn-default\">{{ __('app.cancel') }}
@endcan diff --git a/tests/Generators/ViewsGeneratorTest.php b/tests/Generators/ViewsGeneratorTest.php index 926119b..378e0b5 100644 --- a/tests/Generators/ViewsGeneratorTest.php +++ b/tests/Generators/ViewsGeneratorTest.php @@ -22,7 +22,7 @@ class ViewsGeneratorTest extends TestCase

@can('create', new {$this->full_model_name}) - {{ link_to_route('{$this->table_name}.create', __('{$this->lang_name}.create'), [], ['class' => 'btn btn-success']) }} + table_name}.create') }}\" class=\"btn btn-success\">{{ __('{$this->lang_name}.create') }} @endcan
{{ __('{$this->lang_name}.list') }} @@ -32,11 +32,14 @@ class ViewsGeneratorTest extends TestCase
- {{ Form::open(['method' => 'get','class' => 'form-inline']) }} - {!! FormField::text('q', ['label' => __('{$this->lang_name}.search'), 'placeholder' => __('{$this->lang_name}.search_text'), 'class' => 'input-sm']) !!} - {{ Form::submit(__('{$this->lang_name}.search'), ['class' => 'btn btn-sm']) }} - {{ link_to_route('{$this->table_name}.index', __('app.reset')) }} - {{ Form::close() }} +
+
+ + lang_name}.search_text') }}\" name=\"q\" type=\"text\" id=\"q\" class=\"form-control input-sm\" value=\"{{ request('q') }}\"> +
+ lang_name}.search') }}\" class=\"btn btn-sm\"> + table_name}.index') }}\">Reset +

{{ \${$this->single_model_var_name}->description }} @can('update', \${$this->single_model_var_name}) - {!! link_to_route( - '{$this->table_name}.index', - __('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] - ) !!} + table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id] + Request::only('page', 'q')) }}\" id=\"edit-{$this->lang_name}-{{ \${$this->single_model_var_name}->id }}\">{{ __('app.edit') }} @endcan
@@ -55,12 +58,7 @@ class ViewsGeneratorTest extends TestCase @@ -100,9 +98,9 @@ class ViewsGeneratorTest extends TestCase
{{ \${$this->single_model_var_name}->description }} @can('view', \${$this->single_model_var_name}) - {!! link_to_route( - '{$this->table_name}.show', - __('app.show'), - [\${$this->single_model_var_name}], - ['class' => 'btn btn-default btn-xs', 'id' => 'show-{$this->lang_name}-' . \${$this->single_model_var_name}->id] - ) !!} + table_name}.show', \${$this->single_model_var_name}) }}\" id=\"show-{$this->lang_name}-{{ \${$this->single_model_var_name}->id }}\" class=\"btn btn-default btn-xs\">{{ __('app.show') }} @endcan
@can('update', \${$this->single_model_var_name}) - {{ link_to_route('{$this->table_name}.edit', __('{$this->lang_name}.edit'), [\${$this->single_model_var_name}], ['class' => 'btn btn-warning', 'id' => 'edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id]) }} + table_name}.edit', \${$this->single_model_var_name}) }}\" id=\"edit-{$this->lang_name}-{{ \${$this->single_model_var_name}->id }}\" class=\"btn btn-warning\">{{ __('{$this->lang_name}.edit') }} @endcan - {{ link_to_route('{$this->table_name}.index', __('{$this->lang_name}.back_to_index'), [], ['class' => 'btn btn-default']) }} + table_name}.index') }}\" class=\"btn btn-default\">{{ __('{$this->lang_name}.back_to_index') }}
@@ -128,16 +126,25 @@ class ViewsGeneratorTest extends TestCase

{{ __('{$this->lang_name}.create') }}

- {!! Form::open(['route' => '{$this->table_name}.store']) !!} -
- {!! FormField::text('name', ['required' => true, 'label' => __('{$this->lang_name}.name')]) !!} - {!! FormField::textarea('description', ['label' => __('{$this->lang_name}.description')]) !!} -
-
- {!! Form::submit(__('{$this->lang_name}.create'), ['class' => 'btn btn-success']) !!} - {{ link_to_route('{$this->table_name}.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }} -
- {!! Form::close() !!} +
table_name}.store') }}\" accept-charset=\"UTF-8\"> + {{ csrf_field() }} +
+
has('name') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('name', ':message') !!} +
+
has('description') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('description', ':message') !!} +
+
+
+ lang_name}.create') }}\" class=\"btn btn-success\"> + table_name}.index') }}\" class=\"btn btn-default\">{{ __('app.cancel') }} +
+
@@ -174,36 +181,42 @@ class ViewsGeneratorTest extends TestCase
{{ __('{$this->lang_name}.delete_confirm') }}
- {!! FormField::delete( - ['route' => ['{$this->table_name}.destroy', \${$this->single_model_var_name}]], - __('app.delete_confirm_button'), - ['class'=>'btn btn-danger'], - [ - '{$this->lang_name}_id' => \${$this->single_model_var_name}->id, - 'page' => request('page'), - 'q' => request('q'), - ] - ) !!} - {{ link_to_route('{$this->table_name}.edit', __('app.cancel'), [\${$this->single_model_var_name}], ['class' => 'btn btn-default']) }} +
table_name}.destroy', \${$this->single_model_var_name}) }}\" accept-charset=\"UTF-8\" onsubmit=\"return confirm("Are you sure to delete this?")\" class=\"del-form pull-right\" style=\"display: inline;\"> + {{ csrf_field() }} {{ method_field('delete') }} + lang_name}_id\" type=\"hidden\" value=\"{{ \${$this->single_model_var_name}->id }}\"> + + + +
+ table_name}.edit', \${$this->single_model_var_name}) }}\" class=\"btn btn-default\">{{ __('app.cancel') }}
@endcan @else

{{ __('{$this->lang_name}.edit') }}

- {!! Form::model(\${$this->single_model_var_name}, ['route' => ['{$this->table_name}.update', \${$this->single_model_var_name}],'method' => 'patch']) !!} -
- {!! FormField::text('name', ['required' => true, 'label' => __('{$this->lang_name}.name')]) !!} - {!! FormField::textarea('description', ['label' => __('{$this->lang_name}.description')]) !!} -
-
- {!! Form::submit(__('{$this->lang_name}.update'), ['class' => 'btn btn-success']) !!} - {{ link_to_route('{$this->table_name}.show', __('app.cancel'), [\${$this->single_model_var_name}], ['class' => 'btn btn-default']) }} - @can('delete', \${$this->single_model_var_name}) - {{ link_to_route('{$this->table_name}.edit', __('app.delete'), [\${$this->single_model_var_name}, 'action' => 'delete'], ['class' => 'btn btn-danger pull-right', 'id' => 'del-{$this->lang_name}-'.\${$this->single_model_var_name}->id]) }} - @endcan -
- {!! Form::close() !!} +
table_name}.update', \${$this->single_model_var_name}) }}\" accept-charset=\"UTF-8\"> + {{ csrf_field() }} {{ method_field('patch') }} +
+
has('name') ? ' has-error' : '' }}\"> + + single_model_var_name}->name) }}\" required> + {!! \$errors->first('name', ':message') !!} +
+
has('description') ? ' has-error' : '' }}\"> + + + {!! \$errors->first('description', ':message') !!} +
+
+ +