Answer the question
In order to leave comments, you need to log in
How to stop repeating entries?
Help write the code. I looked in the documentation and didn't find anything suitable.
There is Cars - cars and UserCars - where we keep records of how many times and who bought cars.
With one-to-many I can get all the records I need.
Each user can buy the same car many times. Since these machines are sold for a certain period of time.
I want to know how many users this machine has been sold to.
But I can get a completely different figure, since there can be several entries from one user.
Can you please tell me how to make a request?
return $this->hasMany('App\UserCars');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question