Skip to content

Commit

Permalink
Merge pull request #2 from silverhand7/update/custom-namespace-and-di…
Browse files Browse the repository at this point in the history
…rectory

Custom directory not tightened by namespace
  • Loading branch information
silverhand7 authored Oct 19, 2023
2 parents 4767c6e + 3fb613b commit a90bfa6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
18 changes: 15 additions & 3 deletions config/artisan-maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@
return [
/**
* Set your default namespace for Service class.
* This will also affect the directory of your service class location.
*/
'service_namespace' => 'App\Services',

/**
* Set the default directory for your service class location.
*/
'service_directory' => 'app/Services',

/**
* Set your default namespace for Action class
* This will also affect the directory of your action class location.
*/
'action_namespace' => 'App\Actions',

/**
* Set the default directory for your action class location.
*/
'action_directory' => 'app/Actions',

/**
* Set your default namespace for Interface class
* This will also affect the directory of your interface class location.
*/
'interface_namespace' => 'App\Contracts',

/**
* Set the default directory for your interface class location.
*/
'interface_directory' => 'app/Contracts',
];
6 changes: 6 additions & 0 deletions src/Console/FileGenerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ protected function getDefaultNamespace($rootNamespace): string

return $nameSpace;
}

protected function getPath($name)
{
$type = Str::lower($this->type);
return $this->laravel->basePath() . '/' . config("artisan-maker.{$type}_directory") . '/' . $this->getNameInput() .'.php';
}
}
1 change: 0 additions & 1 deletion src/Console/ServiceMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ protected function buildClass($name): string
}
}


$stub = $this->files->get($this->getClassImplementInterfaceStub());

return $this
Expand Down

0 comments on commit a90bfa6

Please sign in to comment.