Skip to content

Commit

Permalink
Merge pull request nWidart#1704 from fpermana/patch-1
Browse files Browse the repository at this point in the history
Update ObserverMakeCommand.php
  • Loading branch information
dcblogdev authored Jan 18, 2024
2 parents 11148d7 + ae6111b commit 33af094
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Commands/ObserverMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function getTemplateContents()
{
$module = $this->laravel['modules']->findOrFail($this->getModuleName());
return (new Stub('/observer.stub', [
'NAMESPACE' => $this->getClassNamespace($module) . '\Observers',
'NAMESPACE' => $this->getClassNamespace($module),
'NAME' => $this->getModelName(),
'MODEL_NAMESPACE' => $this->getModelNamespace(),
'NAME_VARIABLE' => $this->getModelVariable(),
Expand Down Expand Up @@ -120,4 +120,16 @@ public function handle(): int

return 0;
}

/**
* Get default namespace.
*
* @return string
*/
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

return $module->config('paths.generator.observer.namespace') ?: $module->config('paths.generator.observer.path', 'Observers');
}
}

0 comments on commit 33af094

Please sign in to comment.