Skip to content

Commit 449dafc

Browse files
authored
Merge pull request #26 from vicgonvt/feature_namespace_custom
Allow for custom namespacing
2 parents 5759629 + af513de commit 449dafc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Updater.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ class Updater
3434
*/
3535
private $disk;
3636

37+
/**
38+
* @var string
39+
*/
40+
private $baseNamespace = '\\App\\';
41+
3742
/**
3843
* Get files in sync directory.
3944
*
@@ -54,6 +59,16 @@ public function __construct($path = null, $model = null, $remote = false, $disk
5459
$this->files = $this->getFiles($this->directory, $model);
5560
}
5661

62+
/**
63+
* Override the default namespace for the class.
64+
*
65+
* @param $namespace
66+
*/
67+
public function setNamespace($namespace)
68+
{
69+
$this->baseNamespace = $namespace;
70+
}
71+
5772
/**
5873
* Execute syncModel for each file.
5974
*
@@ -232,7 +247,7 @@ protected function getValues(stdClass $record)
232247
*/
233248
protected function getModel(string $name)
234249
{
235-
return '\\App\\'.Str::studly(pathinfo($name, PATHINFO_FILENAME));
250+
return $this->baseNamespace.Str::studly(pathinfo($name, PATHINFO_FILENAME));
236251
}
237252

238253
/**

0 commit comments

Comments
 (0)