Skip to content

Instantly share code, notes, and snippets.

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