From f5b1248a3763724a3b0bc40db2782e886ddeda09 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 14 May 2015 14:44:54 +0300 Subject: [PATCH] Bug fix with model relations If relation has other methods, generating doc is fail. E.g. $this->belongsToMany('App\User')->withTimestamps(); generate this: @property-read \Illuminate\Database\Eloquent\Collection|\App\User')->withTimestamps([] $drinks --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index c71e9c7..425a9a7 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -340,7 +340,7 @@ class ModelsCommand extends Command $search = '$this->' . $relation . '('; if ($pos = stripos($code, $search)) { $code = substr($code, $pos + strlen($search)); - $arguments = explode(',', substr($code, 0, strpos($code, ');'))); + $arguments = explode(',', substr($code, 0, strpos($code, ')'))); //Remove quotes, ensure 1 \ in front of the model $returnModel = $this->getClassName($arguments[0], $model); if ($relation === "belongsToMany" or $relation === 'hasMany' or $relation === 'morphMany' or $relation === 'morphToMany') {