Created
August 5, 2018 09:30
-
-
Save ragasubekti/f97741b9ff4f91ebb36c97e345789067 to your computer and use it in GitHub Desktop.
GQL Type Pegawai
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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