Skip to content
This repository was archived by the owner on Feb 26, 2018. It is now read-only.

Commit bd9cbc5

Browse files
committed
Merge pull request #28 from adamwathan/52-compatibility
Use correct Composer class for different Laravel versions
2 parents 89b4bac + b088f49 commit bd9cbc5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: src/Installation/InstallCommand.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
use Illuminate\Console\Command;
44
use Illuminate\Filesystem\Filesystem;
5-
use Illuminate\Foundation\Composer;
5+
use Illuminate\Foundation\Composer as Composer51;
6+
use Illuminate\Support\Composer as Composer52;
67
use Symfony\Component\Console\Input\InputOption;
78

89
class InstallCommand extends Command
@@ -12,11 +13,16 @@ class InstallCommand extends Command
1213
protected $name = 'eloquent-oauth:install';
1314
protected $description = 'Install package config and migrations';
1415

15-
public function __construct(Filesystem $filesystem, Composer $composer)
16+
public function __construct(Filesystem $filesystem)
1617
{
1718
parent::__construct();
1819
$this->filesystem = $filesystem;
19-
$this->composer = $composer;
20+
21+
if (starts_with(app()->version(), '5.1')) {
22+
$this->composer = app(Composer51::class);
23+
} else {
24+
$this->composer = app(Composer52::class);
25+
}
2026
}
2127

2228
public function handle()

0 commit comments

Comments
 (0)