Skip to content

Instantly share code, notes, and snippets.

@onurkose
Created May 20, 2018 08:58
Show Gist options
  • Save onurkose/32d4c9f8b93ac6b17e1bca7a06a68c40 to your computer and use it in GitHub Desktop.
Save onurkose/32d4c9f8b93ac6b17e1bca7a06a68c40 to your computer and use it in GitHub Desktop.
<?php
namespace App\GraphQL\Types\System\TranslationManager;
// Project Model
use App\System\TranslationManager\Project\Project;
use GraphQL;
use GraphQL\Type\Definition\Type;
use Rebing\GraphQL\Support\Type as GraphQLType;
class ProjectsType extends GraphQLType
{
protected $attributes = [
'name' => 'ProjectsType',
'description' => 'A type of projects',
'model' => Project::class,
];
public function fields()
{
return [
'id' => [
'type' => Type::nonNull(Type::int()),
'description' => 'The id of the project'
],
'name' => [
'type' => Type::string(),
'description' => 'The name of the project'
],
'status' => [
'type' => Type::string(),
'description' => 'The status of the project'
],
'locales' => [
'type' => Type::listOf(GraphQL::type('locales_type')),
'description' => 'A list of locales assigned to the project'
]
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment