diff --git a/src/Updater.php b/src/Updater.php index 63c6d22..a8188f3 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -34,6 +34,11 @@ class Updater */ private $disk; + /** + * @var string + */ + private $baseNamespace = '\\App\\'; + /** * Get files in sync directory. * @@ -54,6 +59,16 @@ class Updater $this->files = $this->getFiles($this->directory, $model); } + /** + * Override the default namespace for the class. + * + * @param $namespace + */ + public function setNamespace($namespace) + { + $this->baseNamespace = $namespace; + } + /** * Execute syncModel for each file. * @@ -232,7 +247,7 @@ class Updater */ protected function getModel(string $name) { - return '\\App\\'.Str::studly(pathinfo($name, PATHINFO_FILENAME)); + return $this->baseNamespace.Str::studly(pathinfo($name, PATHINFO_FILENAME)); } /**