5 changed files with 101 additions and 4 deletions
-
1src/CrudMake.php
-
29src/Generators/ShowViewGenerator.php
-
4src/stubs/view-edit.stub
-
28src/stubs/view-show.stub
-
43tests/Generators/ViewsGeneratorTest.php
@ -0,0 +1,29 @@ |
|||
<?php |
|||
|
|||
namespace Luthfi\CrudGenerator\Generators; |
|||
|
|||
/** |
|||
* Show View Generator Class |
|||
*/ |
|||
class ShowViewGenerator extends BaseGenerator |
|||
{ |
|||
/** |
|||
* {@inheritDoc} |
|||
*/ |
|||
public function generate(string $type = 'full') |
|||
{ |
|||
$viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name'])); |
|||
|
|||
$this->generateFile($viewPath.'/show.blade.php', $this->getContent('view-show')); |
|||
|
|||
$this->command->info($this->modelNames['model_name'].' show view file generated.'); |
|||
} |
|||
|
|||
/** |
|||
* {@inheritDoc} |
|||
*/ |
|||
protected function getContent(string $stubName) |
|||
{ |
|||
return $this->replaceStubString($this->getStubFileContent($stubName)); |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('title', trans('master.detail')) |
|||
|
|||
@section('content') |
|||
<div class="row"> |
|||
<div class="col-md-6 col-md-offset-3"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">{{ trans('master.detail') }}</h3></div> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr> |
|||
<td>{{ trans('master.name') }}</td> |
|||
<td>{{ $singleMstr->name }}</td> |
|||
</tr> |
|||
<tr> |
|||
<td>{{ trans('master.description') }}</td> |
|||
<td>{{ $singleMstr->description }}</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<div class="panel-footer"> |
|||
{{ link_to_route('masters.edit', trans('app.edit'), [$singleMstr], ['class' => 'btn btn-default', 'id' => 'edit-master-'.$singleMstr->id]) }} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue