@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/{chunk-WFEVU3LX.js → chunk-FCTB4WKW.js} +14 -2
- package/dist/{chunk-WFEVU3LX.js.map → chunk-FCTB4WKW.js.map} +1 -1
- package/dist/index.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +13 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -3387,6 +3387,17 @@ function getModuleName2(schema) {
|
|
|
3387
3387
|
}
|
|
3388
3388
|
return "";
|
|
3389
3389
|
}
|
|
3390
|
+
function getFieldExpression(fieldName, propDef) {
|
|
3391
|
+
switch (propDef.type) {
|
|
3392
|
+
case "Date":
|
|
3393
|
+
return `$this->${fieldName}?->toDateString()`;
|
|
3394
|
+
case "DateTime":
|
|
3395
|
+
case "Timestamp":
|
|
3396
|
+
return `$this->${fieldName}?->toISOString()`;
|
|
3397
|
+
default:
|
|
3398
|
+
return `$this->${fieldName}`;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3390
3401
|
function getPropertyOutput(propName, propDef, schemas, options) {
|
|
3391
3402
|
const snakeName = toSnakeCase(propName);
|
|
3392
3403
|
const lines = [];
|
|
@@ -3433,7 +3444,8 @@ function getPropertyOutput(propName, propDef, schemas, options) {
|
|
|
3433
3444
|
}
|
|
3434
3445
|
return lines;
|
|
3435
3446
|
}
|
|
3436
|
-
|
|
3447
|
+
const expression = getFieldExpression(snakeName, propDef);
|
|
3448
|
+
lines.push(` '${snakeName}' => ${expression},`);
|
|
3437
3449
|
return lines;
|
|
3438
3450
|
}
|
|
3439
3451
|
function generateResourceBase(schema, schemas, options) {
|