mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19553f63e4 | ||
|
|
f50470ba49 | ||
|
|
7762e07f0a | ||
|
|
467b5f5b5f | ||
|
|
c213be3d3c | ||
|
|
4b8ba85b34 | ||
|
|
d4c0ae5851 | ||
|
|
3a01e351de | ||
|
|
add34665a8 | ||
|
|
c77752bb58 | ||
|
|
aa8f772a46 | ||
|
|
0c4c55f349 | ||
|
|
ed972acf19 | ||
|
|
60e642e881 | ||
|
|
4069863d0c | ||
|
|
da05897cb7 | ||
|
|
74bac1a4e9 | ||
|
|
33cee80609 | ||
|
|
dee3878566 | ||
|
|
eb5736a7bd | ||
|
|
cc794a2fba | ||
|
|
d82e8f191f |
+2
-2
@@ -14,8 +14,8 @@
|
||||
"illuminate/support": "5.0.x|5.1.x|5.2.x",
|
||||
"illuminate/console": "5.0.x|5.1.x|5.2.x",
|
||||
"illuminate/filesystem": "5.0.x|5.1.x|5.2.x",
|
||||
"phpdocumentor/reflection-docblock": "2.0.4",
|
||||
"symfony/class-loader": "~2.3"
|
||||
"phpdocumentor/reflection-docblock": "^2.0.4",
|
||||
"symfony/class-loader": "~2.3|~3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "~2.3"
|
||||
|
||||
@@ -71,8 +71,8 @@ class MetaCommand extends Command {
|
||||
|
||||
$bindings = array();
|
||||
foreach ($this->getAbstracts() as $abstract) {
|
||||
// Validator causes problems in Lumen
|
||||
if ($abstract == 'validator') {
|
||||
// Validator and seeder cause problems
|
||||
if (in_array($abstract, ['validator', 'seeder'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,8 @@ class ModelsCommand extends Command
|
||||
}
|
||||
|
||||
if (!$reflectionClass->IsInstantiable()) {
|
||||
throw new \Exception($name . ' is not instantiable.');
|
||||
// ignore abstract class or interface
|
||||
continue;
|
||||
}
|
||||
|
||||
$model = $this->laravel->make($name);
|
||||
@@ -290,6 +291,7 @@ class ModelsCommand extends Command
|
||||
|
||||
$comment = $column->getComment();
|
||||
$this->setProperty($name, $type, true, true, $comment);
|
||||
$this->setMethod(Str::camel("where_" . $name), '\Illuminate\Database\Query\Builder|\\' . get_class($model), array('$value'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,6 +356,7 @@ class ModelsCommand extends Command
|
||||
'belongsToMany',
|
||||
'hasOne',
|
||||
'belongsTo',
|
||||
'morphOne',
|
||||
'morphTo',
|
||||
'morphMany',
|
||||
'morphToMany'
|
||||
@@ -375,6 +378,9 @@ class ModelsCommand extends Command
|
||||
true,
|
||||
null
|
||||
);
|
||||
} elseif ($relation === "morphTo") {
|
||||
// Model isn't specified because relation is polymorphic
|
||||
$this->setProperty($method, '\Illuminate\Database\Eloquent\Model|\Eloquent', true, null);
|
||||
} else {
|
||||
//Single model is returned
|
||||
$this->setProperty($method, $relatedModel, true, null);
|
||||
@@ -484,6 +490,10 @@ class ModelsCommand extends Command
|
||||
$phpdoc->appendTag($tag);
|
||||
}
|
||||
|
||||
if ($this->write) {
|
||||
$phpdoc->appendTag(Tag::createInstance("@mixin \\Eloquent", $phpdoc));
|
||||
}
|
||||
|
||||
$serializer = new DocBlockSerializer();
|
||||
$serializer->getDocComment($phpdoc);
|
||||
$docComment = $serializer->getDocComment($phpdoc);
|
||||
@@ -507,7 +517,7 @@ class ModelsCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
$output = "namespace {$namespace}{\n{$docComment}\n\tclass {$classname} {}\n}\n\n";
|
||||
$output = "namespace {$namespace}{\n{$docComment}\n\tclass {$classname} extends \Eloquent {}\n}\n\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -12,6 +12,7 @@ namespace Barryvdh\LaravelIdeHelper;
|
||||
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Config\Repository as ConfigRepository;
|
||||
use ReflectionClass;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Generator
|
||||
@@ -113,11 +114,18 @@ class Generator
|
||||
|
||||
protected function detectDrivers()
|
||||
{
|
||||
$this->interfaces['\Illuminate\Contracts\Auth\Authenticatable'] = config('auth.model', 'App\User');
|
||||
$this->interfaces['\Illuminate\Contracts\Auth\Authenticatable'] = config('auth.providers.users.model', config('auth.model', 'App\User'));
|
||||
|
||||
try{
|
||||
if (class_exists('Auth') && is_a('Auth', '\Illuminate\Support\Facades\Auth', true)) {
|
||||
$class = get_class(\Auth::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