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

Multiple relationship to same table, Cannot redeclare App\Models\... #36

Open
josenobile opened this issue Jan 25, 2021 · 0 comments
Open

Comments

@josenobile
Copy link

Hello,

When there is a relationship like a table A to table B in field A1, and with table B in field A2, it will result in getB defined twice, the proposed solution is to concatenate the field name: getBA1 and getBA2

I would happy if you give some guide to locate the part of the code responsible to define the method/function names for relationships in order to fork the project, fix and submit a pull request.

Here is the output

php artisan laracrud:mvc usuarios

   Symfony\Component\ErrorHandler\Error\FatalError

  Cannot redeclare App\Models\Usuario::avantelInventarioSimcards()

  at ...\app\Models\Usuario.php:196
    192▕     * avantelInventarioSimcards
    193▕     *
    194▕     * @return \Illuminate\Database\Eloquent\Relations\HasMany
    195▕     */
  ➜ 196▕     public function avantelInventarioSimcards()
    197▕     {
    198▕         return $this->hasMany(AvantelInventarioSimcard::class,'usuario_ult_edicion');
    199▕     }
    200▕

Because there is an uncaught fatal error, the script stopped generating anything else.

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

No branches or pull requests

1 participant