Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: signifly/laravel-api-responder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: signifly/laravel-api-responder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 7 commits
  • 5 files changed
  • 3 contributors

Commits on Oct 5, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    40a3394 View commit details
  2. Copy the full SHA
    ba4a089 View commit details
  3. Copy the full SHA
    969d0d1 View commit details

Commits on Oct 6, 2020

  1. Merge pull request #1 from telkins/fix-respond-trait

    Two unrelated fixes...
    pactode authored Oct 6, 2020
    Copy the full SHA
    af6ffbb View commit details

Commits on Dec 30, 2020

  1. Added PHP 8.0 support.

    telkins committed Dec 30, 2020
    Copy the full SHA
    45e267c View commit details

Commits on Jan 4, 2021

  1. Merge pull request #2 from telkins/master

    Added PHP 8.0 support.
    pactode authored Jan 4, 2021
    Copy the full SHA
    1292f34 View commit details

Commits on Nov 21, 2023

  1. Copy the full SHA
    5167380 View commit details
Showing with 18 additions and 13 deletions.
  1. +1 −0 .travis.yml
  2. +4 −0 CHANGELOG.md
  3. +7 −7 composer.json
  4. +2 −2 src/Concerns/Respondable.php
  5. +4 −4 src/Responder.php
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ php:
- 7.2
- 7.3
- 7.4
- 8.0

env:
matrix:
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

All notable changes to `laravel-api-responder` will be documented in this file

## 1.3.2 - 2020-12-30

- Add support for PHP 8.0

## 1.3.1 - 2020-09-11

- Add support for Laravel 8.0
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@
}
],
"require": {
"php": "^7.2.5",
"illuminate/contracts": "^6.0|^7.0|^8.0",
"illuminate/database": "^6.0|^7.0|^8.0",
"illuminate/http": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0"
"php": "^7.2.5 || ^8.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/http": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^8.0|^9.0",
"orchestra/testbench": "^4.0|^5.0|^6.0"
"phpunit/phpunit": "^7.0|^8.0|^9.0|^10.0",
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0"
},
"autoload": {
"psr-4": {
4 changes: 2 additions & 2 deletions src/Concerns/Respondable.php
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@

trait Respondable
{
protected function respond($data): Responsable
protected function respond($data, ?string $resourceClass = null): Responsable
{
return app(Responder::class)->respond($data);
return app(Responder::class)->respond($data, $resourceClass);
}
}
8 changes: 4 additions & 4 deletions src/Responder.php
Original file line number Diff line number Diff line change
@@ -62,9 +62,9 @@ public function respond($data, ?string $resourceClass = null): Responsable
*/
protected function respondForCollection(Collection $data, ?string $resourceClass)
{
$modelClass = $this->modelResolver->resolve($data, 'collection');

if (is_null($resourceClass)) {
$modelClass = $this->modelResolver->resolve($data, 'collection');

$resourceClass = empty($modelClass)
? config('responder.default_resource', JsonResource::class)
: $this->resourceResolver->resolve($modelClass);
@@ -96,9 +96,9 @@ protected function respondForModel(Model $model, ?string $resourceClass)
*/
protected function respondForPaginator(LengthAwarePaginator $data, ?string $resourceClass)
{
$modelClass = $this->modelResolver->resolve($data, 'paginator');

if (is_null($resourceClass)) {
$modelClass = $this->modelResolver->resolve($data, 'paginator');

$resourceClass = empty($modelClass)
? config('responder.default_resource', JsonResource::class)
: $this->resourceResolver->resolve($modelClass);