From 65284ceeaebd42af90ff1453c8c6d6214482546e Mon Sep 17 00:00:00 2001 From: Maicol Battistini Date: Tue, 8 Feb 2022 17:17:51 +0100 Subject: [PATCH] fix: Usa solo snakecase con le relations --- resources/js/Components/Pages/RecordsPage.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/js/Components/Pages/RecordsPage.tsx b/resources/js/Components/Pages/RecordsPage.tsx index 40088f873..1985dedf4 100644 --- a/resources/js/Components/Pages/RecordsPage.tsx +++ b/resources/js/Components/Pages/RecordsPage.tsx @@ -12,7 +12,10 @@ import { ToManyRelation, ToOneRelation } from 'coloquent'; -import {capitalize} from 'lodash-es'; +import { + capitalize, + snakeCase +} from 'lodash-es'; import type { Children, Vnode, @@ -430,7 +433,7 @@ export class RecordsPage extends Page { } for (const [relation, relatedModel] of Object.entries(relations)) { - model.setRelation(relation, relatedModel); + model.setRelation(snakeCase(relation), relatedModel); } const response = await model.save();