Jens Segers wrote about the new Eloquent attribute casting and how he has been using it:
For me personally, this will be especially useful when working with boolean values. Boolean values are usually stored as a TINYINT in the database, and when Eloquent fetches the model again, they are returned as a “1” or “0” string. “Luckily” for us, PHP does some type juggling and implicitly converts it to the correct boolean values.
Building rich client side apps with this is really going to be awesome. No more parseInt() or crazy checks to see what data you are getting. I’m a big fan of this feature.
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
Larvel™ A new enterprise framework
PHP is one of the most widely used web development languages, but it has long been considered the worst to work with.…
27 Video Tutorials for Learning Laravel 5
Laracasts has been hard at work on the Laravel Fundamentals series. If you haven’t been keeping up, it’s…