/**
* Get the scaffolded template for a view
*
* @param string $name
* @return string Compiled template
*/
protected function getScaffoldedTemplate($name)
{
$model = $this->cache->getModelName();
// post
$models = Pluralizer::plural($model);
// posts
$Models = ucwords($models);
// Posts
$Model = Pluralizer::singular($Models);
// Post
// Create and Edit views require form elements
if ($name === 'create.blade' or $name === 'edit.blade') {
$formElements = $this->makeFormElements();
$this->template = str_replace('{{formElements}}', $formElements, $this->template);
}
// Replace template vars in view
foreach (array('model', 'models', 'Models', 'Model') as $var) {
$this->template = str_replace('{{' . $var . '}}', ${$var}, $this->template);
}
// And finally create the table rows
list($headings, $fields, $editAndDeleteLinks) = $this->makeTableRows($model);
$this->template = str_replace('{{headings}}', implode(PHP_EOL . "\t\t\t\t", $headings), $this->template);
$this->template = str_replace('{{fields}}', implode(PHP_EOL . "\t\t\t\t\t", $fields) . PHP_EOL . $editAndDeleteLinks, $this->template);
return $this->template;
}