Skip to content

Commit

Permalink
Fix qualifyModel for CRUD creator
Browse files Browse the repository at this point in the history
  • Loading branch information
reziamini committed May 27, 2021
1 parent b45e0e7 commit 135e97e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Commands/CRUDActions/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,20 @@ private function resolveStubPath($stub)
: __DIR__.'/../stub/'.$stub;
}

protected function qualifyModel($model)
{
$model = ltrim($model, '\\/');

$model = str_replace('/', '\\', $model);

$rootNamespace = $this->rootNamespace();

if (Str::startsWith($model, $rootNamespace)) {
return $model;
}

return is_dir(app_path('Models'))
? $rootNamespace.'Models\\'.$model
: $rootNamespace.$model;
}
}

0 comments on commit 135e97e

Please sign in to comment.