Skip to content

Releases: BinarCode/laravel-restify

4.6.3

23 Dec 17:52

Choose a tag to compare

Added

  • Scaffolding UserRepository.

4.6.2

23 Dec 17:08

Choose a tag to compare

Added

  • Scaffolding UserRepository.

4.6.1

23 Dec 17:01

Choose a tag to compare

Added

  • Default scaffold for repository and base repository.

4.6.0

23 Dec 16:37
d02078d

Choose a tag to compare

Added

  • Pivots on the show and index requests, they are now displayed in a pivots object.

Changed

  • Not for being able to attach / detach resources, you MUST have the ManyToMany field defined in the related of the repository.

4.5.4

22 Dec 10:22
dbbeafb

Choose a tag to compare

Fixed

  • Fixed belongs to nullable relationship.

4.5.3

22 Dec 09:12
d474838

Choose a tag to compare

Fixed

  • HasMany field fixed resolve method.

4.5.2

21 Dec 15:52
7b85d3b

Choose a tag to compare

Fixed

  • Fixed bug: get_class() expects parameter 1 to be object, null given

4.5.1

21 Dec 10:12
faf8a37

Choose a tag to compare

Added

  • Added MorphOne field.

4.5.0

21 Dec 09:28
fe628f5

Choose a tag to compare

Added

  • Sorting by belongsTo relationship:

Sometimes you may need to sort by a belongsTo relationship. This become a breeze with Restify. Firstly you have to
instruct your sort to use a relationship:

// PostRepository
use Binaryk\LaravelRestify\Fields\BelongsTo;
use Binaryk\LaravelRestify\Filters\SortableFilter;

public static function sorts(): array
{
    return [
        'users.name' => SortableFilter::make()
            ->setColumn('users.name')
            ->usingBelongsTo(
                BelongsTo::make('user', 'user', UserRepository::class),
        )
    ];
}

Make sure that the column is fully qualified (include the table name).

The request could look like:

GET: /api/restify/posts?sort=-users.name

This will return all posts, sorted descending by users name.

4.4.0

18 Dec 11:57
6907c1e

Choose a tag to compare

Added

  • Support for integer column type for the artisan restify:stub command.

  • Support for managing related entities via Eager fields. For example, if you want to have in relationships an BelongsTo field:

//PostRepository.php

public static function getRelated()
     {
         return [
             'owner' => BelongsTo::make('owner', 'owner', UserRepository::class),
         ];
    }

Then you can get it via related as usual:

/api/restify/posts?related=owner

And the returned object in the relationships will be formatted using UserRepository fields, so you can attach policies and permissions for specific fields in the repository itself.