Skip to content

Instantly share code, notes, and snippets.

@zhwei
Last active February 13, 2020 11:15
Show Gist options
  • Save zhwei/f13ea35b157d4b8687118e6b40ff30b7 to your computer and use it in GitHub Desktop.
Save zhwei/f13ea35b157d4b8687118e6b40ff30b7 to your computer and use it in GitHub Desktop.
<?php
/**
* Supplement to [barryvdh/laravel-ide-helper](https://github.com/barryvdh/laravel-ide-helper)
*
* Usage:
* > cd /your/project/
* > curl https://gist.githubusercontent.com/zhwei/f13ea35b157d4b8687118e6b40ff30b7/raw > _ide_helper_laravel.php
*
* Project Link: https://gist.github.com/zhwei/f13ea35b157d4b8687118e6b40ff30b7
*
* Please Share.
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
}
namespace Illuminate\Database\Eloquent\Relations {
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class BelongsTo
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class BelongsToMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class HasMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class HasManyThrough
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class HasOne
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class HasOneOrMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class MorphMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class MorphOne
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
abstract class MorphOneOrMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class MorphPivot
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class MorphTo
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class MorphToMany
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
class Pivot
{
}
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Model
*
* @see Relation::__call
*/
abstract class Relation
{
}
}
@mattquest
Copy link

Does phpstorm know you're getting a collection back when using a relation like hasMany for instance? That's the final thing I'm missing as far as eliminating the damn squiggly lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment