Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jul 10, 2020
1 parent e8381fb commit 7df640d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Commands/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getControllerName()
/**
* @return array|string
*/
private function getControllerNameWithoutNamespace()
protected function getControllerNameWithoutNamespace()
{
return class_basename($this->getControllerName());
}
Expand All @@ -120,7 +120,7 @@ public function getDefaultNamespace() : string
* Get the stub file name based on the options
* @return string
*/
private function getStubName()
protected function getStubName()
{
if ($this->option('plain') === true) {
$stub = '/controller-plain.stub';
Expand Down
10 changes: 0 additions & 10 deletions src/Commands/stubs/composer.stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,5 @@
"psr-4": {
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": ""
}
},
"extra": {
"laravel": {
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\Main"
],
"aliases": {

}
}
}
}
4 changes: 2 additions & 2 deletions src/Commands/stubs/package.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"cross-env": "^5.1.4",
"laravel-mix": "^4.0.7",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"laravel-mix-merge-manifest": "^0.1.2"
}
}
4 changes: 2 additions & 2 deletions src/Commands/stubs/resource.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace $NAMESPACE$;

use Illuminate\Http\Resources\Json\Resource;
use Illuminate\Http\Resources\Json\JsonResource;

class $CLASS$ extends Resource
class $CLASS$ extends JsonResource
{
/**
* Transform the resource into an array.
Expand Down
12 changes: 7 additions & 5 deletions src/Providers/Laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ public function register()
* Setup stub path.
*/
public function setupStubPath()
{
Stub::setBasePath(__DIR__ . '/Commands/stubs');
{
$path = $this->app['config']->get('module.stubs.path') ?? __DIR__ . '/Commands/stubs';

Stub::setBasePath($path);

$this->app->booted(function ($app) {
$moduleRepository = $app[RepositoryInterface::class];
$repository = $app[RepositoryInterface::class];

if ($moduleRepository->config('stubs.enabled') === true) {
Stub::setBasePath($moduleRepository->config('stubs.path'));
if ($repository->config('stubs.enabled') === true) {
Stub::setBasePath($repository->config('stubs.path'));
}
});
}
Expand Down

0 comments on commit 7df640d

Please sign in to comment.