Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
51fad48
Filter empty `attributes` object
crynobone Nov 28, 2025
c62856b
wip
crynobone Nov 28, 2025
9964a21
wip
crynobone Nov 28, 2025
9f20af7
wip
crynobone Nov 28, 2025
c09f42f
wip
crynobone Nov 28, 2025
f701acf
wip
crynobone Dec 1, 2025
0edfd18
Apply fixes from StyleCI
StyleCIBot Dec 1, 2025
4fc4ec9
Merge branch 'json-api-resource' into json-api-resource-fix-blank-att…
crynobone Dec 1, 2025
fcc8e43
wip
crynobone Dec 1, 2025
af659e8
Apply fixes from StyleCI
StyleCIBot Dec 1, 2025
54d579b
wip
crynobone Dec 1, 2025
a524678
wip
crynobone Dec 1, 2025
84a230c
wip
crynobone Dec 1, 2025
c7c265f
wip
crynobone Dec 1, 2025
496ce0b
wip
crynobone Dec 1, 2025
46ee3b9
wip
crynobone Dec 1, 2025
e4be683
wip
crynobone Dec 1, 2025
e28661c
wip
crynobone Dec 1, 2025
302b3b1
wip
crynobone Dec 2, 2025
92e5d4d
wip
crynobone Dec 2, 2025
7f0b513
wip
crynobone Dec 2, 2025
7af5ced
wip
crynobone Dec 2, 2025
29d6aa2
wip
crynobone Dec 2, 2025
15f56cd
wip
crynobone Dec 2, 2025
b33b40b
wip
crynobone Dec 2, 2025
6f52875
wip
crynobone Dec 2, 2025
c93256e
Apply fixes from StyleCI
StyleCIBot Dec 2, 2025
ac5c68e
wip
crynobone Dec 3, 2025
c5a50bc
wip
crynobone Dec 2, 2025
ade3d72
wip
crynobone Dec 3, 2025
0293974
wip
crynobone Dec 3, 2025
7f4b3f0
wip
crynobone Dec 3, 2025
bac37e2
wip
crynobone Dec 3, 2025
29f6f53
Apply fixes from StyleCI
StyleCIBot Dec 3, 2025
d9d9d97
wip
crynobone Dec 3, 2025
4eef51c
wip
crynobone Dec 3, 2025
17faaff
wip
crynobone Dec 3, 2025
29a4a5d
wip
crynobone Dec 3, 2025
b400eec
wip
crynobone Dec 3, 2025
17a7b7f
wip
crynobone Dec 3, 2025
e76de92
wip
crynobone Dec 3, 2025
48042f3
wip
crynobone Dec 3, 2025
3ffb5c5
wip
crynobone Dec 4, 2025
ad15208
wip
crynobone Dec 4, 2025
7f75fb0
Apply fixes from StyleCI
StyleCIBot Dec 4, 2025
2ec3972
[JSON:API] Handles Nested Relationship (#58009)
crynobone Dec 4, 2025
5b3eef7
Remove dump from JsonApiResourceTest
crynobone Dec 5, 2025
4a0c6cd
formatting
taylorotwell Dec 9, 2025
4e318f3
formatting
taylorotwell Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Illuminate/Http/Resources/Json/JsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected static function newCollection($resource)
*/
public function resolve($request = null)
{
$data = $this->toAttributes(
$data = $this->resolveResourceData(
$request ?: $this->resolveRequestFromContainer()
);

Expand All @@ -132,9 +132,24 @@ public function resolve($request = null)
*/
public function toAttributes(Request $request)
{
if (property_exists($this, 'attributes')) {
return $this->attributes;
}

return $this->toArray($request);
}

/**
* Resolve the resource data to an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function resolveResourceData(Request $request)
{
return $this->toAttributes($request);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timacdonald I believe this should make it easier timacdonald/json-api forward compatible with a small change to TiMacDonald\JsonApi\JsonApiResource:

    /**
     * Resolve the resource data to an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function resolveResourceData(Request $request)
    {
        return $this->toArray($request);
    }


/**
* Transform the resource into an array.
*
Expand Down
Loading
Loading