Under the hood: How model attributes work in Laravel

Laravel model attributes are basically representing the database fields for the given model. When data is retrieved from the database, it can be accessed through the model as they were actual properties of the model instance: $model->database_column_name. However the attributes are not real properties of the instance, but they are stored in the protected $attributes …