Skip to content

Commit c022009

Browse files
authored
[fix_bug] Creating a repository with a model
1 parent b91e2ea commit c022009

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Commands/Repository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function putInFile($filename, $content)
125125
*/
126126
protected function setModelAndNamespace(&$model, &$namespace)
127127
{
128-
$exploded = explode('\\', $model);
128+
$exploded = str_contains($model, '/') ? explode('/', $model) : explode('\\', $model);
129129
$model = Arr::last($exploded);
130130
$namespace = '';
131131

@@ -143,7 +143,7 @@ protected function setModelAndNamespace(&$model, &$namespace)
143143
*/
144144
protected function modelFileExists($model)
145145
{
146-
return file_exists( base_path(lcfirst($model).'.php'));
146+
return file_exists( base_path(lcfirst($model).'.php')) || file_exists( base_path(lcfirst(str_replace('\\', '/', $model)).'.php'));
147147
}
148148

149149
/**
@@ -164,7 +164,7 @@ public function handle()
164164
if (is_null($model)) {
165165
$content = $this->replaceClassName($name, $this->getEmptyStub());
166166
} else {
167-
if (Str::contains($model, '\\')) {
167+
if (Str::contains($model, ['\\', '/'])) {
168168
$this->setModelAndNamespace($model, $namespace);
169169
}
170170

@@ -197,4 +197,4 @@ public function handle()
197197
}
198198
}
199199
}
200-
}
200+
}

0 commit comments

Comments
 (0)