Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 439 Bytes

response-fractal-serializer.md

File metadata and controls

16 lines (12 loc) · 439 Bytes

Fractal Transformer Serializer

You can set the serializer to be used by DataTables using setSerializer api. Serializer should be used with setTransformer api.

use DataTables;

Route::get('user-data', function() {
	$model = App\User::query();

	return DataTables::eloquent($model)
					->setTransformer(new App\Transformers\UserTransformer)
					->setSerializer(new App\Serializers\CustomSerializer)
					->toJson();
});