How to resolve Not unique table/alias error in laravel?

632 Views Asked by At

I am very new to the laravel,i am using l5-repository package for orderBy and sortedBy to sort columns ,while hitting API i am getting following error please help me to resolve the issue

my API URL :-http://localhost.com/v1/domain?limit=250&page=1&orderBy=users|name&sortedBy=desc

1

There are 1 best solutions below

2
On

You probrably have an error in your table name. For default, laravel will look for cards table name for a model named Card. Also, take a look in your models name. I espect you misstype card.php because it should be Card.php. Laravel uses a lot of psr convention and Eloquent (who deal with relationships and that stuff). If you are not well versed into it, take a look in how to name classes. As Alireza said, take a look in the Laravel's documentation, it is awesome and complete. When you have a one to many realtionship, one of they should have a hasMany(...) instead belongsTo(....)