lundi 19 septembre 2016

re-transform when Calling the backend data. (with fractal)

If I've used Fractal for presenting one Post Content like the following

return [
           'titulo'=>$post->title
           'contenido'=>$post->body,
   ]

Im presenting my table made in english to spanish, one benefit is to hide the original table columns names from the public. So When the time of sorting from the frontend I would need to sent like the sortkey=titulo but at the PostsController I would have to make an if or switch Case which re-transform the Value to its original Value. My question is there a better way to translate the data sent to the backend? I could sent the translated word directly to the Controller but the original data would be exposed.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire