mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
@@ -505,7 +505,7 @@ class ModelsCommand extends Command
|
|||||||
'morphedByMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany'
|
'morphedByMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany'
|
||||||
) as $relation => $impl) {
|
) as $relation => $impl) {
|
||||||
$search = '$this->' . $relation . '(';
|
$search = '$this->' . $relation . '(';
|
||||||
if (stripos($code, $search) || $impl === (string)$type) {
|
if (stripos($code, $search) || ltrim($impl, '\\') === ltrim((string)$type, '\\')) {
|
||||||
//Resolve the relation's model to a Relation object.
|
//Resolve the relation's model to a Relation object.
|
||||||
$methodReflection = new \ReflectionMethod($model, $method);
|
$methodReflection = new \ReflectionMethod($model, $method);
|
||||||
if ($methodReflection->getNumberOfParameters()) {
|
if ($methodReflection->getNumberOfParameters()) {
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ class Simple extends Model
|
|||||||
return $this->belongsToMany(Simple::class);
|
return $this->belongsToMany(Simple::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relationBelongsToManyWithSub(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Simple::class)->where('foo', 'bar');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function relationBelongsToManyWithSubAnother(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->relationBelongsToManyWithSub()->where('foo', 'bar');
|
||||||
|
}
|
||||||
|
|
||||||
public function relationMorphTo(): MorphTo
|
public function relationMorphTo(): MorphTo
|
||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
|||||||
* @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToInAnotherNamespace
|
* @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToInAnotherNamespace
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToMany
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToMany
|
||||||
* @property-read int|null $relation_belongs_to_many_count
|
* @property-read int|null $relation_belongs_to_many_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToManyWithSub
|
||||||
|
* @property-read int|null $relation_belongs_to_many_with_sub_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToManyWithSubAnother
|
||||||
|
* @property-read int|null $relation_belongs_to_many_with_sub_another_count
|
||||||
* @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToSameNameAsColumn
|
* @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToSameNameAsColumn
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationHasMany
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationHasMany
|
||||||
* @property-read int|null $relation_has_many_count
|
* @property-read int|null $relation_has_many_count
|
||||||
@@ -113,6 +117,16 @@ class Simple extends Model
|
|||||||
return $this->belongsToMany(Simple::class);
|
return $this->belongsToMany(Simple::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relationBelongsToManyWithSub(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Simple::class)->where('foo', 'bar');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function relationBelongsToManyWithSubAnother(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->relationBelongsToManyWithSub()->where('foo', 'bar');
|
||||||
|
}
|
||||||
|
|
||||||
public function relationMorphTo(): MorphTo
|
public function relationMorphTo(): MorphTo
|
||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
|
|||||||
Reference in New Issue
Block a user