Change return values

Use Carbon by default, and allow Eloquent array (but should be changed
to the real models)
This commit is contained in:
Barry vd. Heuvel
2013-05-03 11:31:56 +02:00
parent 9410f00cb5
commit 47f60456f4
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -59,8 +59,8 @@ For now, only models in app/models are scanned. The optional argument tells what
`php artisan ide-helper:models Post,User` `php artisan ide-helper:models Post,User`
This creates a file with the phpDocs for each Model. You should check and change them to be more accurate. This creates a file with the phpDocs for each Model. You should check and change them to be more accurate.
It doesn't know if datetimes are returned as string or DateTime/Carbon, that depends on your $dates attribute. It doesn't know if datetimes are returned as string or DateTime/Carbon, but I assume they are.
Also, all relations are Eloquent by default, you can change them to the actual Model. Also, all relations are Eloquent|Eloquent[] by default, you can change them to the actual Model.
After copying the phpdocs to your model, you can clear the file, so your IDE only uses the real source. After copying the phpdocs to your model, you can clear the file, so your IDE only uses the real source.
@@ -155,7 +155,7 @@ class ModelsCommand extends Command {
break; break;
case 'datetimetz': //String or DateTime, depending on $dates case 'datetimetz': //String or DateTime, depending on $dates
case 'datetime': case 'datetime':
$type = 'string|DateTime'; $type = '\Carbon\Carbon';
break; break;
default: default:
$type = 'mixed'; $type = 'mixed';
@@ -184,7 +184,7 @@ class ModelsCommand extends Command {
} }
}elseif(!method_exists('Eloquent', $method) && !\Str::startsWith($method, 'get')){ }elseif(!method_exists('Eloquent', $method) && !\Str::startsWith($method, 'get')){
//If not declared in parent class, assuming relation. //If not declared in parent class, assuming relation.
$this->setProperty($method, 'Eloquent', true, null); $this->setProperty($method, 'Eloquent|Eloquent[]', true, null);
} }
} }
} }