Laravel 5 Eloquent ORM Model Get Attributes

This is how you can handle your models data using Accessor Functions. Laravel’s great ORM gives us awesome abilities and control over our models attributes.

JSON
If your storing data in JSON you can load it using this.

Then the mutator (set) function would look like this.

COLLECTION
If your storing data in Collections you can load it using this.

COMMA SEPARATED LIST
If your storing data in comma separated lists you can load it using this.

Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *