This does not break old code because the Model object implements ArrayableInterface. We can still access the callback with
function($m) { return $m['id']; }
as well as
function($m) { return $m->id; }
Now though, we can access modified attributes from Eloquent getters as well as relations on each model. A nice easy change without breaking backwards compatibility. :-)
This does not break old code because the Model object implements ArrayableInterface. We can still access the callback with
as well as
Now though, we can access modified attributes from Eloquent getters as well as relations on each model. A nice easy change without breaking backwards compatibility. :-)