You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
906 B

<?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('resources/views/full/show'));
$this->command->info($this->modelNames['model_name'].' show view file generated.');
}
/**
* {@inheritDoc}
*/
public function getContent(string $stubName)
{
if ($this->command->option('formfield')) {
$stubName .= '-formfield';
}
if ($this->command->option('bs3')) {
$stubName .= '-bs3';
}
return $this->replaceStubString($this->getStubFileContent($stubName));
}
}