diff --git a/src/Repositories/ModuleRepository.php b/src/Repositories/ModuleRepository.php index 3f0a40aa9..8ecba82cb 100644 --- a/src/Repositories/ModuleRepository.php +++ b/src/Repositories/ModuleRepository.php @@ -881,10 +881,10 @@ protected function getModelRepository($relation, $modelOrRepository = null) if ($repository instanceof ModuleRepository) { return $repository; - } else { - $class = Config::get('twill.namespace') . "\\Repositories\\" . ucfirst($modelOrRepository) . "Repository"; } + $class = Config::get('twill.namespace') . "\\Repositories\\" . ucfirst($modelOrRepository) . "Repository"; + if (class_exists($class)) { return App::make($class); } @@ -895,7 +895,7 @@ protected function getModelRepository($relation, $modelOrRepository = null) throw new Exception("Repository class not found for model '{$modelOrRepository}'"); } - return App::make($capsule['repository']); + return App::make($capsule->getRepositoryClass()); } /**