Releases: BinarCode/laravel-restify
Releases · BinarCode/laravel-restify
3.14.0
3.13.0
3.12.2
3.12.1
Added
Profile via User Repository
You can use the UserRepository (if you have one), to resolve the profile and perform the updates over the profile by using the UserProfile trait in your repository:
class UserRepository extends Repository
{
use Binaryk\LaravelRestify\Repositories\UserProfile;
}Checkout the documentation for more details.
3.12.0
Added
- Match by datetime
class PostRepository extends Repository
{
public static $match = [
'published_at' => RestifySearchable::MATCH_DATETIME,
];
}Request:
GET: /restify-api/posts?published_at=2020-12-01- Match by array
class PostRepository extends Repository
{
public static $match = [
'published_at' => RestifySearchable::MATCH_ARRAY,
];
}Request:
GET: /restify-api/posts?id=1,2,3This will be converted to:
->whereIn('id', [1, 2, 3])- Negate a match
GET: /restify-api/posts?-id=1,2,3This will return all posts where doesn't have the id in the [1,2,3] list.
You can apply - (negation) for every match:
GET: /restify-api/posts?-title="Some title"3.11.0
Added
This is very wanted feature, for a long time.
- Actions, an action performed to a bunch of models, or to a single model. Check it out
Before:
After:
3.10.0
Added
Bulk store
POST: restify-api/posts/bulkPayload:
[ { "title": "Post title 1"}, { "title": "Post title 2"} ]Bulk udpate
This is as well post. Just because using "POST" you can pass form data:
POST: restify-api/posts/bulk/updatePayload:
[ { "id":1, "title": "Post title 1"}, { "id": 2, "title": "Post title 2"} ]3.9.0
3.8.0
Added
- RestResponse static
indexmethod, so you can return the same format for a custom paginator.
$paginator = User::query()->paginate(5);
$response = Binaryk\LaravelRestify\Controllers\RestResponse::index(
$paginator
);Changed
- Signature of the
resolveIndexMainMetamethod, now it accept thepaginatorMetainformation:
public function resolveIndexMainMeta(RestifyRequest $request, Collection $items, array $paginationMeta): array
3.7.0
Index main meta
You can also override the main meta object for the index, not the one for per item:
public function resolveIndexMainMeta(RestifyRequest $request, Collection $items)
{
$default = parent::resolveIndexMeta($request);
return array_merge($default, [
'next_payment_at' => $this->resource->current_payment_at->addMonth(),
]);
}
