mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
Add support for Lumen 5.0, 5.1 and 5.2+
This commit is contained in:
+8
-2
@@ -11,8 +11,8 @@
|
||||
namespace Barryvdh\LaravelIdeHelper;
|
||||
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Config\Repository as ConfigRepository;
|
||||
use ReflectionClass;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Generator
|
||||
@@ -118,7 +118,13 @@ class Generator
|
||||
|
||||
try{
|
||||
if (class_exists('Auth') && is_a('Auth', '\Illuminate\Support\Facades\Auth', true)) {
|
||||
$authMethod = version_compare(Application::VERSION, '5.2', '>=') ? 'guard' : 'driver';
|
||||
if (class_exists('\Illuminate\Foundation\Application')) {
|
||||
$authMethod = version_compare(\Illuminate\Foundation\Application::VERSION, '5.2', '>=') ? 'guard' : 'driver';
|
||||
} else {
|
||||
$refClass = new ReflectionClass('\Laravel\Lumen\Application');
|
||||
$versionStr = $refClass->newInstanceWithoutConstructor()->version();
|
||||
$authMethod = strpos($versionStr, 'Lumen (5.0') === 0 ? 'driver' : (strpos($versionStr, 'Lumen (5.1') === 0 ? 'driver' : 'guard');
|
||||
}
|
||||
$class = get_class(\Auth::$authMethod());
|
||||
$this->extra['Auth'] = array($class);
|
||||
$this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
|
||||
|
||||
Reference in New Issue
Block a user