mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Extend eloquent from Query Builder
Fixes #6 Eloquent doesn't have the where() methods, and other query methods, but resolves them with __call(). Extending the Builder class seems the most appropriate solution.
This commit is contained in:
@@ -104,7 +104,9 @@ class GeneratorCommand extends Command {
|
||||
|
||||
$output = "<?php\nnamespace {\n\tdie('Only to be used as an helper for your IDE');\n}\n\n";
|
||||
|
||||
foreach($aliasLoader->getAliases() as $alias => $facade){
|
||||
$aliases = $aliasLoader->getAliases();
|
||||
$aliases += array('QueryBuilder' => "Illuminate\Database\Query\Builder");
|
||||
foreach($aliases as $alias => $facade){
|
||||
|
||||
try{
|
||||
if(method_exists($facade, 'getFacadeRoot')){
|
||||
@@ -142,8 +144,10 @@ class GeneratorCommand extends Command {
|
||||
|
||||
$output .= "namespace $namespace {\n";
|
||||
|
||||
//If the root class is not the same as the facade extend it.
|
||||
if($root !== $facade || in_array($alias, $onlyExtend)){
|
||||
if($alias == "Eloquent"){
|
||||
$output .= " class $alias extends QueryBuilder{\n";
|
||||
}elseif($root !== $facade || in_array($alias, $onlyExtend)){
|
||||
//If the root class is not the same as the facade extend it.
|
||||
$output .= " class $alias extends $facade{\n";
|
||||
}else{
|
||||
$output .= " class $alias{\n";
|
||||
|
||||
Reference in New Issue
Block a user