Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lindyhopchris committed Apr 10, 2022
2 parents 0acdae7 + ffc0969 commit 43bdb41
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file. This project adheres to
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).

## [2.2.0] - 2022-04-10

### Added

- [#181](https://github.com/laravel-json-api/laravel/issues/181) The `JsonApiController` now extends the base Laravel
controller.

### Fixed

- [#180](https://github.com/laravel-json-api/laravel/pull/180) Add missing method to the Authorizer stub.

## [2.1.2] - 2022-04-04

### Fixed
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
Implement feature-rich [JSON:API](https://jsonapi.org) compliant APIs in your
[Laravel](https://laravel.com) applications. Build your next standards-compliant API today.

### Why use JSON:API?
## Why use JSON:API and Laravel JSON:API?

Great question! [Here's some reasons from this excellent article by Denisa Halmaghi](https://graffino.com/web-development/how-to-use-laravel-json-api-to-create-a-json-api-compliant-backend-in-laravel):

### Why Use JSON:API?

- Standardised, consistent APIs.
- Feature rich - some of which are filtering, pagination, eager loading and sparse fieldsets.
- Feature rich - some of which are: sparse fieldsets (only fetch the fields you need), filtering, sorting, pagination,
eager loading for relationships (includes, which solve the _N+1_ problem).
- Easy to understand.

### Why use Laravel JSON:API?
Expand Down
5 changes: 2 additions & 3 deletions src/Http/Controllers/JsonApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller;

class JsonApiController
class JsonApiController extends Controller
{

/**
* JSON:API Actions
*/
Expand All @@ -46,5 +46,4 @@ class JsonApiController
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;

}
15 changes: 14 additions & 1 deletion stubs/authorizer.stub
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@ class {{ class }} implements Authorizer
}

/**
* Authorize the show-related and show-relationship controller action.
* Authorize the show-related controller action
*
* @param Request $request
* @param object $model
* @param string $fieldName
* @return bool
*/
public function showRelated(Request $request, object $model, string $fieldName): bool
{
// TODO: Implement showRelated() method.
}

/**
* Authorize the show-relationship controller action.
*
* @param Request $request
* @param object $model
Expand Down

0 comments on commit 43bdb41

Please sign in to comment.