Skip to content

Commit

Permalink
feat: Add GraphQLConvertable
Browse files Browse the repository at this point in the history
Add trait which allows enums to be converted to the GQL values.
  • Loading branch information
alberthaff committed Mar 25, 2024
1 parent dfcd880 commit 3fbf9f5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Definition/Concerns/GraphQLConvertable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Worksome\GraphQLHelpers\Definition\Concerns;

use Jawira\CaseConverter\Convert;

/**
* @property-read string $name
*/
trait GraphQLConvertable
{
public function graphQLValue(): string
{
return (new Convert($this->name))->toMacro();
}
}

0 comments on commit 3fbf9f5

Please sign in to comment.