Skip to content
 
 

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

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

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages