Skip to content

Releases: BinarCode/laravel-restify

3.16.0

02 Sep 13:14
e6ff1e9

Choose a tag to compare

Added

Standalone actions

Sometimes you don't need to have an action with models. Let's say for example the authenticated user wants to disable his account. For this we have standalone actions:

// UserRepository

    public function actions(RestifyRequest $request)
    {
        return [
            DisableProfileAction::new()->standalone(),
        ];
    }

URI Key

Usually the URL for the action is make based on the action name. You can use your own URI key if you want:

class DisableProfileAction extends Action
{
    public static $uriKey = 'disable_profile';

    //...
}

3.15.0

24 Aug 14:15
f7efaf9

Choose a tag to compare

Added

  • mainQuery on repositories, now you can use this for show and index endpoints
  • Added Binaryk\LaravelRestify\Models\CreationAware interface. Now you can extend it, and you will take the control over the model saving
  • now you can add a single entity to related

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'];