Command php artisan ide-helper:models do not consider nullable morphs, and recognize such properties as \Illuminate\Database\Eloquent\Model|\Eloquent. Instead it should be of type \Illuminate\Database\Eloquent\Model|\Eloquent|null.
// migration
Schema::create('examples', function (Blueprint $table) {
$table->nullableMorphs('column');
});
// class Example
public function column(): MorphTo
{
return $this->morphTo('column');
}
Summary
Command
php artisan ide-helper:models
do not consider nullable morphs, and recognize such properties as\Illuminate\Database\Eloquent\Model|\Eloquent
. Instead it should be of type\Illuminate\Database\Eloquent\Model|\Eloquent|null
.