Skip to content

Commit

Permalink
compatibility with 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Apr 16, 2017
1 parent 758f1c8 commit 6a7a002
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/Commands/ScaffoldMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Summerblue\Generator\Commands;

use Illuminate\Console\DetectsApplicationNamespace;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Input;
Expand All @@ -23,7 +22,7 @@

class ScaffoldMakeCommand extends Command
{
use DetectsApplicationNamespace, MakerTrait;
use MakerTrait;

/**
* The console command name!
Expand Down Expand Up @@ -69,7 +68,6 @@ public function __construct(Filesystem $files)
{
parent::__construct();


$this->files = $files;
$this->composer = app()['composer'];
}
Expand Down Expand Up @@ -342,4 +340,20 @@ public function getObjName($config = 'Name')

return $names[$config];
}

// AppNamespaceDetectorTrait and DetectsApplicationNamespace compatibility
protected function getAppNamespace()
{
$composer = json_decode(file_get_contents(base_path().'/composer.json'), true);

foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path)
{
foreach ((array) $path as $pathChoice)
{
if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) return $namespace;
}
}

throw new RuntimeException("Unable to detect application namespace.");
}
}

0 comments on commit 6a7a002

Please sign in to comment.