MOTOSHARE ššļø
Turning Idle Vehicles into Shared Rides & Earnings
From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.
With Motoshare, every parked vehicle finds a purpose.
Owners earn. Renters ride.
š Everyone wins.
To delete data from the database with a relationship with two tables in Laravel we have to use the solution that Iāve used.
Now, Question is Where and when we use this Method ?Code language: JavaScript (javascript)
Let’s Discuss, what problems I faced and how Solved it.
In my project, Iāve two Tables in the Database 1st is myĀ UsersĀ table where users’ data is stored.Ā
See the below image:-

And 2nd isĀ SocialProvidersĀ where the user’sĀ Provider IDĀ is stored (whenever a user login with Google, Facebook, etc then a unique provider_id is stored to verify the users ) with the user_id to find which provider is for which user.Ā
See the below image:-

and whenever I Delete a user then I have to delete User data from bothĀ the UsersĀ table andĀ SocialProvidersĀ table for that user.
Now, My problem is that I am not able to delete theĀ UserĀ data fromĀ the SocialProvidersĀ table but the user’s table data is deleted, and when the user re-login with the same Email ID then an error occurs.