$model */ public function __construct(protected string $model) { parent::__construct(); } public function name(): string { return 'Delete'.Str::pascal(class_basename($this->model)); } public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { $model = Arr::pull($args, 'model'); $args = collect($args) ->filter(fn ($value): bool => $value instanceof Model) ->prepend($model) ->values() ->all(); return ($this->response = Gate::inspect('delete', $args))->allowed(); } /** * Get the arguments for the create mutation. * * @return Argument[] */ public function arguments(): array { $arguments = []; $baseType = $this->baseType(); if ($baseType instanceof BaseType) { $arguments[] = $this->resolveBindArguments($baseType->fieldClasses()); } return Arr::flatten($arguments); } public function type(): Type { return Type::nonNull(GraphQL::type($this->baseType()->name())); } }