Monday, April 3, 2017

sql delete query with where, and, or in laravel

Hello i am building a delete query to delete an row out of my database in laravel and i came to this problem i need to find a row where ... and ... or ... and ...

So in normal php that would be

DELETE * FROM connection_requests 
WHERE `user_id`=$user->id AND `selected_user_id`=$id OR 
`selected_user_id`=$user->id AND `user_id`=$id;

(The first and belongs to the where and the second and belongs to the or)

now how do i do this in laravel



via Peter Arents

Advertisement