Skip to content
/ restful Public

A RESTful API package of general helpers for the Laravel framework.

Notifications You must be signed in to change notification settings

bilyiv/restful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The bilyiv/restful package

This package under active developing. Please don't use it in production.

Documentation

Filter, sort and embed parameters

Now, you can easily apply query filter, sort and embed parameters to your Eloquent model:

$posts = Post::filter($request->input('filter', []))->get();
$posts = Post::sort($request->input('sort', []))->get();
$posts = Post::embed($request->input('embed', []))->get();

Also, you can shortly paginate their

$paginator = Post::paginateWithParams($request->all());

instead of

$paginator = Post::filter($request->input('filter', []))
    ->sort($request->input('sort', []))
    ->embed($request->input('embed', []))
    ->simplePagination($request->input('limit', 100))
    ->appends($request->all());

Response

You can easily return success response or throw error exception from your controller.

    return $this->response->data($data)->send();
    return $this->response->data($data)->created($location);
    return $this->response->noContent();
    return $this->response->paginated($paginator);
    return $this->response->errorNoFound();

About

A RESTful API package of general helpers for the Laravel framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages