Skip to content

Releases: BinarCode/laravel-restify

9.2.0

01 Jul 20:06
7145785

Choose a tag to compare

Added

Handling Additional Payload Data in Advanced Filters

In some scenarios, you might want to send additional data beyond the standard key and value in your filter payload. For instance, you may need to specify an operator or a column to apply more complex filtering logic. Laravel Restify Advanced Filters provide a way to handle these additional payload fields using the $this->rest() method.

Example Payload

Consider the following payload:

const filters = btoa(JSON.stringify([
    {
        'key': ValueFilter::uriKey(),
        'value': 'Valid%',
        'operator' => 'like',
        'column' => 'description',
    }
]));

const response = await axios.get(`api/restify/posts?filters=${filters}`);

In this payload, besides the standard key and value, we are also sending operator and column. The operator specifies the type of SQL operation, and the column specifies the database column to filter.

Using $this->rest() to Access Additional Data

To handle these additional fields in your filter class, you need to ensure they are accessible via the $this->rest() method. Here is how you can achieve that:

class ValueFilter extends AdvancedFilter
{
    public function filter(RestifyRequest $request, Builder|Relation $query, $value)
    {
        $operator = $this->rest('operator');
        $column = $this->rest('column');

        $query->where($column, $operator, $value);
    }

    public function rules(Request $request): array
    {
        return [];
    }
}

9.1.0

05 Jun 18:14

Choose a tag to compare

Added

  • Ability to cache single policy #605

Restify allows individual caching at the policy level with specific configurations. To enable this, a contract Cacheable must be implemented at the policy level, which enforces the use of the cache() method.

class PostPolicy implements Cacheable
{
    public function cache(): ?CarbonInterface
    {
        return now()->addMinutes();
    }

The cache method is expected to return a CarbonInterface or null. If null is returned, the current policy will NOT cached.

9.0.0

01 Apr 14:00
0454e21

Choose a tag to compare

Added

  • Add support for Laravel 11 (#602)

8.4.0

01 Apr 13:58
0454e21

Choose a tag to compare

Added

  • Add support for Laravel 11 (#602)

8.3.2

30 Dec 12:56
1d41e72

Choose a tag to compare

Fixed

  • Restifyjs setup without auth middleware

8.3.1

30 Dec 08:37
7961f44

Choose a tag to compare

Fixed

8.3.0

22 Nov 10:44
e04841e

Choose a tag to compare

Added

  • Support searching string with single quotes in them #592

8.2.0

07 Sep 07:48
528b2dc

Choose a tag to compare

Added

  • Added natural sort filter #586

Fixed

  • fix: rules method overrides already defined rules #575
  • Cleanup faker from cmd construct #580

8.1.5

07 Sep 07:31
bc9d263

Choose a tag to compare

Fixed

  • Fixed accept string in filters #585

8.1.3

07 Sep 07:28
13fa577

Choose a tag to compare

Fixed

  • Fixed type for resolver #584