laravel-restify

The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

MIT License

Downloads
321.1K
Stars
600
Committers
20

Bot releases are visible (Hide)

laravel-restify - 9.3.1 Latest Release

Published by binaryk 2 months ago

Fixed

  • fix(Bulk Update): Only Validate Data for Current Item in Loop #612
laravel-restify - 9.3.0

Published by binaryk 4 months ago

Apply advanced filters via POST Request (Version 9.3.0+)

Starting from version 9.3.0, Laravel Restify introduces the ability to apply advanced filters using a POST request. This enhancement simplifies the process of sending complex filter payloads without the need for base64 encoding. Now, you can send the filters directly as JSON in the request body:

const filters = [
    {
        'key': 'ready-posts-filter',
        'value': null,
    }
];

const  response = await axios.post(`api/restify/posts/apply-restify-advanced-filters`, { filters });
laravel-restify - 9.2.0

Published by binaryk 4 months ago

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 [];
    }
}
laravel-restify - 9.1.0

Published by binaryk 5 months ago

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.

laravel-restify - 9.0.0

Published by binaryk 7 months ago

Added

  • Add support for Laravel 11 (#602)
laravel-restify - 8.4.0

Published by binaryk 7 months ago

Added

  • Add support for Laravel 11 (#602)
laravel-restify - 8.3.2

Published by binaryk 10 months ago

Fixed

  • Restifyjs setup without auth middleware
laravel-restify - 8.3.1

Published by binaryk 10 months ago

laravel-restify - 8.3.0

Published by binaryk 11 months ago

Added

  • Support searching string with single quotes in them #592
laravel-restify - 8.2.0

Published by binaryk about 1 year ago

Added

  • Added natural sort filter #586

Fixed

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

Published by binaryk about 1 year ago

Fixed

  • Fixed accept string in filters #585
laravel-restify - 8.1.3

Published by binaryk about 1 year ago

Fixed

  • Fixed type for resolver #584
laravel-restify - 8.1.2

Published by binaryk about 1 year ago

Fixed

  • sortable filter update #583
laravel-restify - 8.1.1

Published by binaryk over 1 year ago

Fixed

  • change the route name
laravel-restify - 8.1.0

Published by binaryk over 1 year ago

laravel-restify - 8.0.1

Published by binaryk over 1 year ago

Fixed

  • docs for getters #554
laravel-restify - 8.0.0

Published by binaryk over 1 year ago

Added

  • Support for Laravel 10 #540
  • Introduces a new option to publish specific auth actions #551
  • Take actionable fields into account when calling patch method #547
  • Custom namespaces support #549
  • New artisan restify:routes comment
  • Updated the documentation https://restify.binarcode.com/
  • 💯 - 💯 - 💯 - 💯

Improved

  • Larastan specs
laravel-restify - 7.11.0

Published by binaryk over 1 year ago

Added

  • Support for actionable fields on PATCH method #547

thanks @dsindrilaru

laravel-restify - 7.10.11

Published by binaryk over 1 year ago

Added

  • Now you can use the permission name for the field see authorization:
field('user_id')->canSeeWhen('can manage users'),
laravel-restify - 7.10.4

Published by binaryk over 1 year ago

Fixed

  • Do not display hidden pivots.
Package Rankings
Top 6.09% on Packagist.org
Related Projects