response = Gate::inspect('create', [Like::class]))->allowed(); } /** * Get the arguments for the like mutation. * * @return Argument[] */ public function arguments(): array { $type = new LikeType(); return $this->resolveBindArguments($type->fieldClasses(), false); } /** * @param array $args * @return array */ public function rulesForValidation(array $args = []): array { $type = new LikeType(); return collect($type->fieldClasses()) ->filter(fn (Field $field): bool => $field instanceof CreatableField) ->mapWithKeys(fn (Field&CreatableField $field): array => [$field->getName() => $field->getCreationRules($args)]) ->all(); } /** * The base return type of the mutation. */ public function baseType(): LikeType { return new LikeType(); } public function type(): Type { return GraphQL::type($this->baseType()->getName()); } /** * @param array $args */ public function resolve($root, array $args, $context, ResolveInfo $resolveInfo): mixed { return App::make(ToggleLikeResolver::class) ->store($root, $args); } }