7
7
use Closure ;
8
8
use Validator ;
9
9
use Illuminate \Support \Arr ;
10
- use Illuminate \Support \Fluent ;
11
10
use GraphQL \Type \Definition \NonNull ;
12
11
use GraphQL \Type \Definition \ListOfType ;
13
12
use GraphQL \Type \Definition \WrappingType ;
16
15
use Rebing \GraphQL \Error \AuthorizationError ;
17
16
use GraphQL \Type \Definition \Type as GraphqlType ;
18
17
19
- abstract class Field extends Fluent
18
+ abstract class Field
20
19
{
20
+ protected $ attributes = [];
21
+
21
22
/**
22
23
* Override this in your queries or mutations
23
24
* to provide custom authorization.
25
+ *
26
+ * @param array $args
27
+ * @return bool
24
28
*/
25
29
public function authorize (array $ args ): bool
26
30
{
@@ -204,7 +208,7 @@ protected function getResolver(): ?Closure
204
208
*
205
209
* @return array
206
210
*/
207
- public function getAttributes ()
211
+ public function getAttributes (): array
208
212
{
209
213
$ attributes = $ this ->attributes ();
210
214
@@ -227,7 +231,7 @@ public function getAttributes()
227
231
*
228
232
* @return array
229
233
*/
230
- public function toArray ()
234
+ public function toArray (): array
231
235
{
232
236
return $ this ->getAttributes ();
233
237
}
@@ -259,4 +263,9 @@ public function __isset($key)
259
263
260
264
return isset ($ attributes [$ key ]);
261
265
}
266
+
267
+ public function __set (string $ key , $ value ): void
268
+ {
269
+ $ this ->attributes [$ key ] = $ value ;
270
+ }
262
271
}
0 commit comments