Skip to content

Commit

Permalink
use service provider to register view
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed Aug 25, 2016
1 parent 34427e7 commit 191ec6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/LaravelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function boot()
{
$this->publishes([__DIR__ . '/../config/config.php' => config_path('lighthouse.php')]);
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'lighthouse');
$this->loadViewsFrom(realpath(__DIR__.'/Support/Console/Commands/stubs'), 'lighthouse');

if (config('lighthouse.controller')) {
require_once __DIR__.'/Support/Http/routes.php';
Expand Down
16 changes: 1 addition & 15 deletions src/Support/Console/Commands/TypeMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ protected function getDefaultNamespace($rootNamespace)
protected function buildClass($name)
{
if ($model = $this->option('model')) {
$this->setViewPath();
$stub = $this->getEloquentStub($model);
} else {
$stub = $this->files->get($this->getStub());
Expand All @@ -86,19 +85,6 @@ protected function getOptions()
];
}

/**
* Set config view paths.
*
* @return void
*/
protected function setViewPath()
{
$paths = config('view.paths');
$paths[] = realpath(__DIR__.'/stubs');

config(['view.paths' => $paths]);
}

/**
* Generate stub from eloquent type.
*
Expand All @@ -118,7 +104,7 @@ protected function getEloquentStub($model)

$fields = $this->getTypeFields($model);

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

/**
Expand Down

0 comments on commit 191ec6c

Please sign in to comment.