mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19553f63e4 | ||
|
|
f50470ba49 | ||
|
|
7762e07f0a | ||
|
|
467b5f5b5f | ||
|
|
c213be3d3c | ||
|
|
4b8ba85b34 | ||
|
|
d4c0ae5851 | ||
|
|
3a01e351de | ||
|
|
add34665a8 | ||
|
|
c77752bb58 | ||
|
|
aa8f772a46 | ||
|
|
0c4c55f349 | ||
|
|
ed972acf19 | ||
|
|
4069863d0c |
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
"illuminate/support": "5.0.x|5.1.x|5.2.x",
|
"illuminate/support": "5.0.x|5.1.x|5.2.x",
|
||||||
"illuminate/console": "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",
|
"illuminate/filesystem": "5.0.x|5.1.x|5.2.x",
|
||||||
"phpdocumentor/reflection-docblock": "2.0.4",
|
"phpdocumentor/reflection-docblock": "^2.0.4",
|
||||||
"symfony/class-loader": "~2.3|~3.0"
|
"symfony/class-loader": "~2.3|~3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$reflectionClass->IsInstantiable()) {
|
if (!$reflectionClass->IsInstantiable()) {
|
||||||
throw new \Exception($name . ' is not instantiable.');
|
// ignore abstract class or interface
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$model = $this->laravel->make($name);
|
$model = $this->laravel->make($name);
|
||||||
@@ -290,6 +291,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$comment = $column->getComment();
|
$comment = $column->getComment();
|
||||||
$this->setProperty($name, $type, true, true, $comment);
|
$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',
|
'belongsToMany',
|
||||||
'hasOne',
|
'hasOne',
|
||||||
'belongsTo',
|
'belongsTo',
|
||||||
|
'morphOne',
|
||||||
'morphTo',
|
'morphTo',
|
||||||
'morphMany',
|
'morphMany',
|
||||||
'morphToMany'
|
'morphToMany'
|
||||||
@@ -375,6 +378,9 @@ class ModelsCommand extends Command
|
|||||||
true,
|
true,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
} elseif ($relation === "morphTo") {
|
||||||
|
// Model isn't specified because relation is polymorphic
|
||||||
|
$this->setProperty($method, '\Illuminate\Database\Eloquent\Model|\Eloquent', true, null);
|
||||||
} else {
|
} else {
|
||||||
//Single model is returned
|
//Single model is returned
|
||||||
$this->setProperty($method, $relatedModel, true, null);
|
$this->setProperty($method, $relatedModel, true, null);
|
||||||
@@ -484,6 +490,10 @@ class ModelsCommand extends Command
|
|||||||
$phpdoc->appendTag($tag);
|
$phpdoc->appendTag($tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->write) {
|
||||||
|
$phpdoc->appendTag(Tag::createInstance("@mixin \\Eloquent", $phpdoc));
|
||||||
|
}
|
||||||
|
|
||||||
$serializer = new DocBlockSerializer();
|
$serializer = new DocBlockSerializer();
|
||||||
$serializer->getDocComment($phpdoc);
|
$serializer->getDocComment($phpdoc);
|
||||||
$docComment = $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;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -11,8 +11,8 @@
|
|||||||
namespace Barryvdh\LaravelIdeHelper;
|
namespace Barryvdh\LaravelIdeHelper;
|
||||||
|
|
||||||
use Illuminate\Foundation\AliasLoader;
|
use Illuminate\Foundation\AliasLoader;
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
use ReflectionClass;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class Generator
|
class Generator
|
||||||
@@ -114,11 +114,17 @@ class Generator
|
|||||||
|
|
||||||
protected function detectDrivers()
|
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{
|
try{
|
||||||
if (class_exists('Auth') && is_a('Auth', '\Illuminate\Support\Facades\Auth', true)) {
|
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());
|
$class = get_class(\Auth::$authMethod());
|
||||||
$this->extra['Auth'] = array($class);
|
$this->extra['Auth'] = array($class);
|
||||||
$this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
|
$this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
|
||||||
|
|||||||
Reference in New Issue
Block a user