Closed jeanlucnguyen closed 2 years ago
I believe there's a mistake on the type of relationship currentTeam should be.
As a current_team_id is added to the users table, the relationship between a user and a team should be belongsTo.
current_team_id
users
I discovered the mistake by trying to use a UserFactory with the ->for() method.
->for()
This would return a mistake $relationship->getOwnerKeyName() doesn't exist if you try to do User::factory()->for($team, 'currentTeam')->create()
$relationship->getOwnerKeyName()
User::factory()->for($team, 'currentTeam')->create()
I believe there's a mistake on the type of relationship currentTeam should be.
As a
current_team_id
is added to theusers
table, the relationship between a user and a team should be belongsTo.I discovered the mistake by trying to use a UserFactory with the
->for()
method.This would return a mistake
$relationship->getOwnerKeyName()
doesn't exist if you try to doUser::factory()->for($team, 'currentTeam')->create()