Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationships method name. #706

Closed
tecnoe opened this issue Aug 16, 2019 · 1 comment
Closed

Relationships method name. #706

tecnoe opened this issue Aug 16, 2019 · 1 comment
Assignees

Comments

@tecnoe
Copy link

tecnoe commented Aug 16, 2019

I have the following issue when I generate a model from a table duplicate relationships methods.
Example I have contacts table with 2 foreignkeys.
Table contacts:
created_by
owner
both columns references id on users table. If I run.

php artisan infyom:scaffold User --fromTable --tableName=users
public function alternateContacts()
    {
        return $this->hasMany(\App\Models\AlternateContact::class);
    }

public function alternateContacts()
    {
        return $this->hasMany(\App\Models\AlternateContact::class);
    }

It is possible to add the the foreignkey as a method name, for example owner and createdBy, with the related columns to avoid this issue.

@mitulgolakiya
Copy link
Member

@tecnoe We pushed a fix. Try to update packages by composer update and see if it works and let us know.

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

No branches or pull requests

3 participants