/**
  * Handle the command.
  *
  */
 public function handle()
 {
     $module = $this->module;
     $stream = $this->stream;
     $assignment = $this->assignment;
     $destination = $module->getPath();
     $entity = __DIR__ . '/../../resources/stubs/entity';
     $source = $entity . '/code/{namespace}/';
     /* get the field config params from build.php */
     $fieldConfig = _getFieldConfig($module, $stream->getNamespace(), $assignment->getFieldSlug());
     /* set a list of files to avoid overwrite */
     $this->files->setAvoidOverwrite(_getAvoidOverwrite($module));
     /* get the template data */
     $data = $this->getTemplateData($module, $stream, $assignment, $fieldConfig);
     /* get the namespace destination folder, if any! */
     $namespaceFolder = _getNamespaceFolder($module, $data['namespace'], true);
     $entityDest = $destination . '/src/' . $namespaceFolder . $data['entity_name'];
     /* get the assigned class name, i.e. TextFieldType */
     $fieldTypeClassName = _getFieldTypeClassName($assignment);
     /* (1) process the form builder class */
     if (!$fieldConfig['hide_field']) {
         $this->processFormBuilder($entityDest . '/Form/' . $data['entity_name'] . 'FormBuilder.php', $entity . '/templates/field/form/', $fieldTypeClassName, $data);
     }
     /* (2) process the table column class */
     if (!$fieldConfig['hide_column']) {
         $this->processTableColumns($entityDest . '/Table/' . $data['entity_name'] . 'TableColumns.php', $entity . '/templates/field/table/' . ($data['column_template'] ? 'template/' : ''), $fieldTypeClassName, $data);
     }
     /* (3) process the field language file */
     $this->processFile($destination . '/resources/lang/en/field.php', [$data['field_slug'] => $entity . '/templates/module/field.php'], $data);
 }
 /**
  * Handle the command.
  *
  */
 public function handle()
 {
     $module = $this->module;
     $stream = $this->stream;
     $assignment = $this->assignment;
     $destination = $module->getPath();
     $entity = __DIR__ . '/../../resources/stubs/entity';
     $source = $entity . '/code/{{namespace|studly_case}}/';
     /* get the field config params from build.php */
     $fieldConfig = _getFieldConfig($module, $stream->getNamespace(), $assignment->getFieldSlug());
     /* protect module classes from being overwriten */
     $this->files->setAvoidOverwrite(_config('builder.avoid_overwrite', $module));
     /* get the template data */
     $data = ['config' => _config('builder', $module), 'field_slug' => $assignment->getFieldSlug(), 'vendor' => $module->getVendor(), 'module_slug' => $module->getSlug(), 'namespace' => $stream->getNamespace(), 'stream_slug' => $stream->getSlug(), 'entity_name' => studly_case(str_singular($stream->getSlug())), 'column_template' => $fieldConfig['column_template']];
     $entityDest = $destination . '/src/' . (_config('builder.group', $module) ? $data['namespace'] . '/' : '') . $data['entity_name'];
     /* get the assigned class name, i.e. TextFieldType */
     $fieldTypeClassName = _getFieldTypeClassName($assignment);
     /* (1) process the form builder class */
     if (!$fieldConfig['hide_field']) {
         $this->processFormBuilder($entityDest . '/Form/' . $data['entity_name'] . 'FormBuilder.php', $entity . '/templates/field/form/', $fieldTypeClassName, $data);
     }
     /* (2) process the table column class */
     if (!$fieldConfig['hide_column']) {
         $this->processTableColumns($entityDest . '/Table/' . $data['entity_name'] . 'TableColumns.php', $entity . '/templates/field/table/' . ($data['column_template'] ? 'template/' : ''), $fieldTypeClassName, $data);
     }
     /* (3) process the field language file */
     $this->processFile($destination . '/resources/lang/en/field.php', [$data['field_slug'] => $entity . '/templates/module/field.php'], $data);
 }