private function generateDataTable()
{
$templateData = TemplateUtil::getTemplate('scaffold.datatable', 'laravel-generator');
$templateData = TemplateUtil::fillTemplate($this->commandData->dynamicVars, $templateData);
$headerFieldTemplate = TemplateUtil::getTemplate('scaffold.views.datatable_column', $this->templateType);
$headerFields = [];
foreach ($this->commandData->inputFields as $field) {
if (!$field['inIndex']) {
continue;
}
$headerFields[] = $fieldTemplate = TemplateUtil::fillTemplateWithFieldData($this->commandData->dynamicVars, $this->commandData->fieldNamesMapping, $headerFieldTemplate, $field);
}
$path = $this->commandData->config->pathDataTables;
$fileName = $this->commandData->modelName . 'DataTable.php';
$fields = implode(',' . infy_nl_tab(1, 3), $headerFields);
$templateData = str_replace('$DATATABLE_COLUMNS$', $fields, $templateData);
FileUtil::createFile($path, $fileName, $templateData);
$this->commandData->commandComment("\n{$fileName} created: ");
$this->commandData->commandInfo($fileName);
}