The only way I am aware of is casting your field to a Value Object which defines the type of each property: https://github.com/jessarcher/laravel-castable-data-transfer-object
There is nothing available in native laravel casting a JSON, So you must have to create a custom attribute to cast a JSON column key you can check this out: http://laravel.com/docs/5.1/eloquent-serialization#appending-values-to-json
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community