Skip to content

Instantly share code, notes, and snippets.

@ragasubekti
Created August 5, 2018 09:30
Show Gist options
  • Save ragasubekti/9f6ebec248e6a1652df90b4cf4dc3632 to your computer and use it in GitHub Desktop.
Save ragasubekti/9f6ebec248e6a1652df90b4cf4dc3632 to your computer and use it in GitHub Desktop.
GQL Type OPD
<?php
namespace App\GraphQL\Type;
use GraphQL\Type\Definition\Type;
use Rebing\GraphQL\Support\Type as GraphQLType;
class OpdType extends GraphQLType
{
protected $attributes = [
'name' => 'OpdType',
];
public function fields()
{
return [
[
'type' => Type::nonNull(Type::int()),
'name' => 'kode',
'alias' => 'kdlokasi',
'resolve' => function ($q) {return $q->kdlokasi;},
], [
'type' => Type::string(),
'name' => 'nama',
'alias' => 'nmlokasi',
'resolve' => function ($q) {return $q->nmlokasi;},
],
[
'type' => Type::int(),
'name' => 'kodeParent',
'alias' => 'kdparent',
'resolve' => function ($q) {return $q->kdparent;},
],
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment