This will wrap the original Eloquent
database result for a Laravel application with a database configured as "fetch" => PDO::FETCH_CLASS
. It creates a new object of Illuminate\Database\Eloquent\Collection
and wraps the Eloquent
result in a models
property. This way it's formatted properly for using it with Ember data without any conversions.
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index() {
$index = new Illuminate\Database\Eloquent\Collection;
$index['models'] = Model::all();
return $index;
}