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 9dfdacc commit c5c6c65Copy full SHA for c5c6c65
src/Lodash/Http/Resources/SuccessResource.php
@@ -0,0 +1,34 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
5
+namespace Longman\LaravelLodash\Http\Resources;
6
7
+use function array_merge;
8
9
+class SuccessResource extends JsonResource
10
+{
11
+ public static $wrap = null;
12
13
+ public function __construct(array $resource)
14
+ {
15
+ $this->resource = $resource;
16
17
+ $this->setDataWrapper('');
18
+ }
19
20
+ public function toArray($request): array
21
22
+ /**
23
+ * Merge additional info and unset it
24
+ */
25
+ $result = array_merge(
26
+ $this->resource,
27
+ $this->additional ?? [],
28
+ );
29
30
+ $this->additional([]);
31
32
+ return $result;
33
34
+}
0 commit comments