@@ -24,8 +24,9 @@ class JsonApiResource extends JsonResource
2424 /**
2525 * Create a new resource instance.
2626 *
27- * @param mixed $resource
28- * @param bool|null $authorise
27+ * @param mixed $resource
28+ * @param bool|null $authorise
29+ *
2930 * @return void
3031 */
3132 public function __construct ($ resource , $ authorise = null )
@@ -43,15 +44,16 @@ public function __construct($resource, $authorise = null)
4344 /**
4445 * Transform the resource into an array.
4546 *
46- * @param \Illuminate\Http\Request $request
47+ * @param \Illuminate\Http\Request $request
48+ *
4749 * @return array
4850 */
4951 public function toArray ($ request )
5052 {
5153 if ($ this ->evaluateResponse ()) {
5254 return [
5355 $ this ->merge ($ this ->getResourceIdentifier ()),
54- 'attributes ' => $ this ->getAttributes (),
56+ 'attributes ' => $ this ->getAttributes (),
5557 'relationships ' => $ this ->when ($ this ->relationships , $ this ->relationships ),
5658 ];
5759 }
@@ -66,9 +68,9 @@ public function toArray($request)
6668 */
6769 protected function evaluateResponse ()
6870 {
69- return ! is_array ($ this ->resource )
71+ return !is_array ($ this ->resource )
7072 && $ this ->resource !== null
71- && ! $ this ->resource instanceof MissingValue;
73+ && !$ this ->resource instanceof MissingValue;
7274 }
7375
7476 /**
@@ -80,7 +82,7 @@ public function getResourceIdentifier()
8082 {
8183 return [
8284 $ this ->resource ->getKeyName () => (string ) $ this ->resource ->getKey (),
83- 'type ' => JsonApi::getResourceType ($ this ->resource ),
85+ 'type ' => JsonApi::getResourceType ($ this ->resource ),
8486 ];
8587 }
8688
@@ -94,7 +96,7 @@ protected function getAttributes()
9496 return array_filter (
9597 array_merge ($ this ->resource ->attributesToArray (), $ this ->withAttributes ()),
9698 function ($ value , $ key ) {
97- return ! Str::endsWith ($ key , '_id ' ) && $ key !== $ this ->resource ->getKeyName () && $ value !== null ;
99+ return !Str::endsWith ($ key , '_id ' ) && $ key !== $ this ->resource ->getKeyName () && $ value !== null ;
98100 },
99101 ARRAY_FILTER_USE_BOTH
100102 );
0 commit comments