Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
New JSON-column where() and update() syntax in Laravel 5.3
Jul 11, 2016 @ 16:03:49

In his continuing series of posts looking at the new features in Laravel 5.3, Matt Stauufer has posted this guide to the use in the new JSON column functionality MySQL now provides in recent versions.

While Laravel has had the ability to cast your data to and from JSON since version 5.0, it was previously just a convenience—your data was still just stored in a TEXT field. But MySQL 5.7 introduced an actual JSON column type.

Laravel 5.3 introduces a simple syntax for lookups and updates based on the value of specific keys in your JSON columns.

He gives an example of a simple table with a JSON column storing some metadata for the entry. He includes a bit of example content showing the full entry and related metadata and the where format for querying it. It also includes the ability to run updates on the data just like with any other where clause.

tagged: laravel jon column mysql tutorial series part5 feature

Link: https://mattstauffer.co/blog/new-json-column-where-and-update-syntax-in-laravel-5-3


Trending Topics: