@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.
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  schemaToBlueprint,
25
25
  toColumnName,
26
26
  toTableName
27
- } from "./chunk-WFEVU3LX.js";
27
+ } from "./chunk-FCTB4WKW.js";
28
28
  export {
29
29
  formatColumnMethod,
30
30
  formatForeignKey,
package/dist/plugin.cjs CHANGED
@@ -3312,6 +3312,17 @@ function getModuleName2(schema) {
3312
3312
  }
3313
3313
  return "";
3314
3314
  }
3315
+ function getFieldExpression(fieldName, propDef) {
3316
+ switch (propDef.type) {
3317
+ case "Date":
3318
+ return `$this->${fieldName}?->toDateString()`;
3319
+ case "DateTime":
3320
+ case "Timestamp":
3321
+ return `$this->${fieldName}?->toISOString()`;
3322
+ default:
3323
+ return `$this->${fieldName}`;
3324
+ }
3325
+ }
3315
3326
  function getPropertyOutput(propName, propDef, schemas, options) {
3316
3327
  const snakeName = toSnakeCase(propName);
3317
3328
  const lines = [];
@@ -3358,7 +3369,8 @@ function getPropertyOutput(propName, propDef, schemas, options) {
3358
3369
  }
3359
3370
  return lines;
3360
3371
  }
3361
- lines.push(` '${snakeName}' => $this->${snakeName},`);
3372
+ const expression = getFieldExpression(snakeName, propDef);
3373
+ lines.push(` '${snakeName}' => ${expression},`);
3362
3374
  return lines;
3363
3375
  }
3364
3376
  function generateResourceBase(schema, schemas, options) {