Skip to content

Releases: BinarCode/laravel-restify

3.14.0

05 Aug 07:35
69edb92

Choose a tag to compare

Added

  • Loading relationship from memory (eagers)

3.13.0

26 Jul 10:57
b48e3e4

Choose a tag to compare

Added

  • HasMany field
  • BelongsTo field
  • Custom callback for matching
  • Adding new validation support for Unique
  • Using UsersRepository for user profile
  • Adding prefixes for repositories routes

Fixes

  • Related now works with any page

3.12.2

17 Jul 16:32

Choose a tag to compare

Patch

Fixing filter.

Added

  • booted method for repositories

3.12.1

17 Jul 14:40

Choose a tag to compare

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

15 Jul 16:46

Choose a tag to compare

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,3

This will be converted to:

->whereIn('id', [1, 2, 3])
  • Negate a match
GET: /restify-api/posts?-id=1,2,3

This 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

10 Jul 08:05
499c008

Choose a tag to compare

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:

image

After:

image

3.10.0

03 Jul 14:36
214a3f1

Choose a tag to compare

Added

Bulk store

POST: restify-api/posts/bulk

Payload:

[ { "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/update

Payload:

[ { "id":1, "title": "Post title 1"}, { "id": 2, "title": "Post title 2"} ]

3.9.0

02 Jul 12:42
555fa81

Choose a tag to compare

Force eager loading

However, Laravel Restify provides eager loading based on the query related property,
you may want to force eager load a relationship in terms of using it in fields, or whatever else:

// UserRepository.php

public static $with = ['posts'];

3.8.0

30 Jun 11:36

Choose a tag to compare

Added

  • RestResponse static index method, 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 resolveIndexMainMeta method, now it accept the paginatorMeta information:
public function resolveIndexMainMeta(RestifyRequest $request, Collection $items, array $paginationMeta): array

3.7.0

15 Jun 12:08

Choose a tag to compare

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(),
    ]);
}