diff --git a/tests/Generators/Simple/ViewsGeneratorTest.php b/tests/Generators/Simple/ViewsGeneratorTest.php new file mode 100644 index 0000000..f504984 --- /dev/null +++ b/tests/Generators/Simple/ViewsGeneratorTest.php @@ -0,0 +1,188 @@ +artisan('make:crud-simple', ['name' => $this->model_name, '--no-interaction' => true]); + + $indexViewPath = resource_path("views/{$this->table_name}/index.blade.php"); + $this->assertFileExists($indexViewPath); + $indexViewContent = "@extends('layouts.app') + +@section('title', trans('{$this->lang_name}.list')) + +@section('content') +
| {{ trans('app.table_no') }} | +{{ trans('{$this->lang_name}.name') }} | +{{ trans('{$this->lang_name}.description') }} | +{{ trans('app.action') }} | +
|---|---|---|---|
| {{ \${$this->collection_model_var_name}->firstItem() + \$key }} | +{{ \${$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->single_model_var_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->single_model_var_name}-' . \${$this->single_model_var_name}->id] + ) !!} + @endcan + | +
{{ \$editable{$this->model_name}->name }}
+ +{{ \$editable{$this->model_name}->description }}
+ {!! \$errors->first('{$this->lang_name}_id', ':message') !!} +