mercredi 1 juin 2016

Laravel Data Converter

I have a model that holds 7 digits as string. I want to create converter that the interaction between the user and that string will be like ##-###-##. So if the model holds 1234567 the user will see 12-345-67 and if the user entered the number as 76-543-21 the model stores it like 7654321.

Many other platforms are including converters to handle this kind of tasks. How can I do that in Laravel 5.2? I have searched in the docs and didn't find any helpful solution.

Is Laravel 5.2 support converters? And how should I handle such conversion?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire