bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

Pass the Model object to the callback function instead of the row array #44

Closed ChrisReid closed 11 years ago

ChrisReid commented 11 years ago

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. :-)