We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8dcab92 commit faaf276Copy full SHA for faaf276
app/Extensions/Spatie/Fractalistic/Fractal.php
@@ -39,6 +39,15 @@ public function createData()
39
}
40
41
42
+ if (is_null($this->resourceName) && $this->data instanceof LengthAwarePaginator) {
43
+ $item = collect($this->data->items())->first();
44
+ if ($item instanceof Model) {
45
+ if (defined(get_class($item) . '::RESOURCE_NAME')) {
46
+ $this->resourceName = constant(get_class($item) . '::RESOURCE_NAME');
47
+ }
48
49
50
+
51
return parent::createData();
52
53
0 commit comments