Skip to content

Commit

Permalink
use relaytype interface for eloquent generated types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed Aug 25, 2016
1 parent 2b672a6 commit d7af8b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Support/Console/Commands/TypeMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ protected function getEloquentStub($model)
$model = config('lighthouse.model_path') . "\\" . $model;
}

$relay = $this->option('relay');
$fields = $this->getTypeFields($model);

return "<?php\n\n" . view('lighthouse::eloquent', compact('model', 'shortName', 'fields'))->render();
return "<?php\n\n" . view('lighthouse::eloquent', compact(
'model', 'shortName', 'fields', 'relay'
))->render();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Support/Console/Commands/stubs/eloquent.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use GraphQL;
use GraphQL\Type\Definition\Type;
use Nuwave\Lighthouse\Support\Definition\RelayType;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Support\Definition\GraphQLType;
use Nuwave\Lighthouse\Support\Interfaces\RelayType;
use {{ $model }};

class DummyClass extends RelayType
class DummyClass extends GraphQLType{{ $relay ? ' implements RelayType' : '' }}
{
/**
* Attributes of Type.
Expand Down

0 comments on commit d7af8b6

Please sign in to comment.