From 47f60456f42410aa3f0a8eb795638d34daf683e9 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 3 May 2013 11:31:56 +0200 Subject: [PATCH] Change return values Use Carbon by default, and allow Eloquent array (but should be changed to the real models) --- readme.md | 4 ++-- src/Barryvdh/LaravelIdeHelper/ModelsCommand.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index df3a614..d42cda8 100644 --- a/readme.md +++ b/readme.md @@ -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` 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. -Also, all relations are Eloquent by default, you can change them to the actual Model. +It doesn't know if datetimes are returned as string or DateTime/Carbon, but I assume they are. +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. diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index 0a8a12e..13e9732 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -155,7 +155,7 @@ class ModelsCommand extends Command { break; case 'datetimetz': //String or DateTime, depending on $dates case 'datetime': - $type = 'string|DateTime'; + $type = '\Carbon\Carbon'; break; default: $type = 'mixed'; @@ -184,7 +184,7 @@ class ModelsCommand extends Command { } }elseif(!method_exists('Eloquent', $method) && !\Str::startsWith($method, 'get')){ //If not declared in parent class, assuming relation. - $this->setProperty($method, 'Eloquent', true, null); + $this->setProperty($method, 'Eloquent|Eloquent[]', true, null); } } }