diff --git a/src/CrudSimpleMake.php b/src/CrudSimpleMake.php index 8b75b5b..328b47e 100644 --- a/src/CrudSimpleMake.php +++ b/src/CrudSimpleMake.php @@ -108,6 +108,6 @@ class CrudSimpleMake extends GeneratorCommand { app('Luthfi\CrudGenerator\Generators\LangFileGenerator', ['command' => $this])->generate(); app('Luthfi\CrudGenerator\Generators\FormViewGenerator', ['command' => $this])->generate(); - app('Luthfi\CrudGenerator\Generators\IndexViewGenerator', ['command' => $this])->generate(); + app('Luthfi\CrudGenerator\Generators\IndexViewGenerator', ['command' => $this])->generate('simple'); } } diff --git a/src/Generators/IndexViewGenerator.php b/src/Generators/IndexViewGenerator.php index c5e0c25..a33e3d5 100644 --- a/src/Generators/IndexViewGenerator.php +++ b/src/Generators/IndexViewGenerator.php @@ -14,7 +14,7 @@ class IndexViewGenerator extends BaseGenerator { $viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name'])); - $this->generateFile($viewPath.'/index.blade.php', $this->getContent('view-index')); + $this->generateFile($viewPath.'/index.blade.php', $this->getContent('view-index-'.$type)); $this->command->info($this->modelNames['model_name'].' index view file generated.'); } diff --git a/src/stubs/view-index-full.stub b/src/stubs/view-index-full.stub new file mode 100644 index 0000000..bacad5b --- /dev/null +++ b/src/stubs/view-index-full.stub @@ -0,0 +1,58 @@ +@extends('layouts.app') + +@section('title', trans('master.list')) + +@section('content') +
| {{ trans('app.table_no') }} | +{{ trans('master.name') }} | +{{ trans('master.description') }} | +{{ trans('app.action') }} | +
|---|---|---|---|
| {{ $mstrCollections->firstItem() + $key }} | +{{ $singleMstr->name }} | +{{ $singleMstr->description }} | ++ @can('view', $singleMstr) + {!! link_to_route( + 'masters.show', + trans('app.show'), + [$singleMstr], + ['class' => 'btn btn-default', 'id' => 'show-master-' . $singleMstr->id] + ) !!} + @endcan + | +