Eloquent-Model-Generator
Eloquent-Model-Generator copied to clipboard
duplicate name method
Hi, After I generate, name method was dublicate ex:
public function affiliateCustomerInvites() { return $this->hasMany(\App\Models\AffiliateCustomerInvite::class, 'customer_id', 'id'); } public function affiliateCustomerInvites() { return $this->hasMany(\App\Models\AffiliateCustomerInvite::class, 'inviter_id', 'id'); }
I'm experiencing the same error. The problem is in this code: https://github.com/pepijnolivier/Eloquent-Model-Generator/blob/v2.0.0/src/Console/GenerateModelsCommand.php#L247
It doesn't check to see if the name is already used for that class. If it did detect it's already used, I'm not sure what it should even do here? affiliateCustomerInvites1, affiliateCustomerInvites2, etc? That wouldn't be an intuitive ORM to use... I think it might make sense to have the more frequently accessed function / the one that makes logical sense. I'm doing this part by hand right now. Maybe at the minimum just emit a warning about those class names / function names?