Skip to content

Releases: BinarCode/laravel-restify

4.3.0

17 Dec 12:55
609bed8

Choose a tag to compare

Changed

  • The format of filters related repository will include a new key:
'repository' => {
 'key' => 'posts',
 'url' => 'api/restify/posts',
 'display_key' => 'id',
 'title' => 'Posts'
}

4.2.0

16 Dec 15:04
843e13f

Choose a tag to compare

Added

Match definition

You can implement a match filter definition, and specify for example related repository:

  public static $match = [
        'title' => 'string',
        'user_id' => MatchFilter::make()
            ->setType('int')
            ->setRelatedRepositoryKey(UserRepository::uriKey()),
];

When you will list this filter (with posts/filters?only=matches), you will get:

  {
      "class": "Binaryk\LaravelRestify\Filters\MatchFilter"
      "key": "matches"
      "type": "string"
      "column": "title"
      "options": []
    },
    {
      "class": "Binaryk\LaravelRestify\Filters\MatchFilter"
      "key": "matches"
      "type": "int"
      "column": "user_id"
      "options": []
      "related_repository_key": "users"
      "related_repository_url": "//users"
    }

4.1.1

12 Dec 15:58
794ee15

Choose a tag to compare

Changed

  • Changed the method signature of the fromRelation and fromBuildermethods for the repository cast.
    abstract public static function fromBuilder(RestifyRequest $request, Builder $builder, Repository $repository): Collection;

    abstract public static function fromRelation(RestifyRequest $request, Relation $relation, Repository $repository): Collection;

4.1.0

12 Dec 15:32
053fbfc

Choose a tag to compare

Added

  • Support for using a custom related cast class (aka transformer). You can do so by modifying the restify.casts.related property. The default related cast is Binaryk\LaravelRestify\Repositories\Casts\RelatedCast.

The cast class should extends the Binaryk\LaravelRestify\Repositories\Casts\RepositoryCast abstract class.

Copy the default config to your restify.php configuration:

    'casts' => [
        /*
        |--------------------------------------------------------------------------
        | Casting the related entities format.
        |--------------------------------------------------------------------------
        |
        */
        'related' => \Binaryk\LaravelRestify\Repositories\Casts\RelatedCast::class,
    ],

4.0.1

09 Dec 13:13
6bbdaec

Choose a tag to compare

Fixed

  • Fix: Fallback for plain related values

4.0.0

08 Dec 11:09
66d7b1c

Choose a tag to compare

Added

  • Available filters.
  • Fields for relations.
  • Security improvements.
  • Mock data generator: php artisan restify:stub users --count=10 now support relations

And much much more, see official documentation.

3.18.0

30 Oct 08:33
a0da4c8

Choose a tag to compare

Fixed

Psalm comments.

3.17.0

16 Oct 10:14
287da8b

Choose a tag to compare

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