@famgia/omnify-laravel 0.0.81 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3337,6 +3337,17 @@ function getModuleName2(schema) {
3337
3337
  }
3338
3338
  return "";
3339
3339
  }
3340
+ function getFieldExpression(fieldName, propDef) {
3341
+ switch (propDef.type) {
3342
+ case "Date":
3343
+ return `$this->${fieldName}?->toDateString()`;
3344
+ case "DateTime":
3345
+ case "Timestamp":
3346
+ return `$this->${fieldName}?->toISOString()`;
3347
+ default:
3348
+ return `$this->${fieldName}`;
3349
+ }
3350
+ }
3340
3351
  function getPropertyOutput(propName, propDef, schemas, options) {
3341
3352
  const snakeName = toSnakeCase(propName);
3342
3353
  const lines = [];
@@ -3383,7 +3394,8 @@ function getPropertyOutput(propName, propDef, schemas, options) {
3383
3394
  }
3384
3395
  return lines;
3385
3396
  }
3386
- lines.push(` '${snakeName}' => $this->${snakeName},`);
3397
+ const expression = getFieldExpression(snakeName, propDef);
3398
+ lines.push(` '${snakeName}' => ${expression},`);
3387
3399
  return lines;
3388
3400
  }
3389
3401
  function generateResourceBase(schema, schemas, options) {
@@ -3967,4 +3979,4 @@ export {
3967
3979
  getFactoryPath,
3968
3980
  laravelPlugin
3969
3981
  };
3970
- //# sourceMappingURL=chunk-WFEVU3LX.js.map
3982
+ //# sourceMappingURL=chunk-FCTB4WKW.js.map