mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Prevent undefined property errors (#877)
If the property name matches the foreign key name creating a BelongsTo relation triggers an undefined property error. Disabling constraints prevents accessing the property and thus prevents the error.
This commit is contained in:
@@ -62,4 +62,9 @@ class Simple extends Model
|
||||
{
|
||||
return $this->belongsTo(AnotherModel::class);
|
||||
}
|
||||
|
||||
public function relationBelongsToSameNameAsColumn(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AnotherModel::class, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user