Created
July 10, 2014 08:30
-
-
Save 18601673727/6a6555d6fd0f78b540fd to your computer and use it in GitHub Desktop.
an laravel typical route with fractal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('posts/{ids}', function ($ids) { | |
$ids = explode(',', $ids); | |
return Post::whereIn('id', $ids)->get(); | |
})->where('ids', '[\d,]+'); | |
Route::get('posts', function () { | |
return Response::api()->withCollection(Post::all(), new PostTransformer); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment