init
This commit is contained in:
34
schema/SettingsMutationType.php
Normal file
34
schema/SettingsMutationType.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace dominion\settings\schema;
|
||||
|
||||
use GraphQL\Type\Definition\ObjectType;
|
||||
use GraphQL\Type\Definition\Type;
|
||||
use dominion\settings\Settings;
|
||||
|
||||
class SettingsMutationType extends ObjectType
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$config = [
|
||||
'fields' => function() {
|
||||
return [
|
||||
'save' => [
|
||||
'type' => Type::int(),
|
||||
'description' => 'Сохранение наклейки',
|
||||
'args' => [
|
||||
'code' => Type::nonNull(Type::string()),
|
||||
'value' => Type::nonNull(Type::string()),
|
||||
],
|
||||
'resolve' => function($root, $args) {
|
||||
return Settings::setValue($args['code'], $args['value']);
|
||||
},
|
||||
],
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user