34 lines
973 B
PHP
34 lines
973 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|