1. Go to this page and download the library: Download soyhuce/next-ide-helper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use App\Email;
class EmailCast implements \Illuminate\Contracts\Database\Eloquent\CastsAttributes
{
public function get($model, $key, $value, $attributes): Email
{
return new Email($value);
}
// ...
}
class User extends Model
{
protected $casts = [
'email' => EmailCast::class,
];
}
/**
* @property-read string $upper_name
*/
class User extends Model
{
public function getUpperNameAttribute(): string
{
return Str::upper($this->name);
}
}
use \App\Collections\UserCollection;
/**
* @method static \App\Collections\UserCollection all(array|mixed $columns = ['*'])
*/
class User extends Model
{
public function newCollection(array $models = []): UserCollection
{
return new UserCollection($models);
}
}
use App\Builder\UserBuilder;
/**
* @method static \App\Builder\UserBuilder query()
* @mixin \App\Builder\UserBuilder
*/
class User extends Model
{
public function newEloquentBuilder($query)
{
return new UserBuilder($query);
}
}
class User extends Model
{
public function scopeWhereVerified($query, bool $verified = true): void
{
$query->whereNull('email_verified_at', 'and', !$verified);
}
}
/**
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Post> $posts
*/
class User extends Model
{
public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
}
class Post extends Model
{
public function scopeWherePublished($query): void
{
return $query->whereNotNull('published_at');
}
}
/**
* @phpstan-method static \App\Collections\UserCollection<int, \App\Models\User> all(array|mixed $columns = ['*'])
*/
class User extends Model {}
class User extends Model
{
public function role(): BelongsTo
{
return $this->belongsTo(Role::class);
}
public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
public function newCollection(array $models = [])
{
return new UserCollection($models);
}
}
class MultitenantBootstrapper implements \Soyhuce\NextIdeHelper\Contracts\Bootstrapper
{
private Tenancy $tenancy;
public function __construct(Tenancy $tenancy)
{
$this->tenancy = $tenancy;
}
public function bootstrap() : void
{
$tenant = \App\Tenant::firstOrFail();
$this->tenancy->connect($tenant);
}
}
// Note that this code is completely fictive.
/**
* Comment that will not be overwritten after docblock generation
*
* @author John Doe
* @package Foo Bar
* @deprecated since 1.0.0
* @api
*
* @generated
* [the content generated by next-ide-helper will be inserted here]
*/
class SomeModel extends Model {}