l5-repository: Generator broken for Laravel 5.4

Generator throws error.

php artisan make:entity Blah

  [Symfony\Component\Debug\Exception\FatalErrorException]
  Trait 'Illuminate\Console\AppNamespaceDetectorTrait' not found

Fixed in #331

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 15 (1 by maintainers)

Most upvoted comments

The PR #330 makes the package compatible with versions 5.1, 5.2, 5.3 and 5.4.

Illuminate\Console\AppNamespaceDetectorTrait is not required.

/**
 * Get application namespace
 * 
 * @return string
 */
public function getAppNamespace()
{
    return \Illuminate\Container\Container::getInstance()->getNamespace();
}


/**
 * Get class name.
 *
 */
public function getRootNamespace()
{
    return config('repository.generator.rootNamespace', $this->getAppNamespace());
}

+1 Please add Laravel 5.4.* support.

Apparently the trait AppNamespaceDetectorTrait had a modification changing its name to DetectsApplicationNamespace so to make the generator to work in versions 5.4+ of Laravel simply has to use the DetectsApplicationNamespace class