Define 'not working'. How did it stop working, was it constructing a query that failed, did the function not execute at all? Was there any error messages?
Nov 26, 2015
1
Level 5
Having clause doesn't work with PostgreSQL
Was working on porting a project in MySQLto PostgreSQL.
And this was the part where I retrieve the users with whom the photo is shared with. This was working as expected when I was using MySQL. Then I ported to PostgreSQL and this line stopped working.
$sharedWith = $photo->users()->having('permission', '!=', 'owner')->get();
Changed that line to this and everything works fine now.
$sharedWith = $photo->users()->where('photo_user.permission', '!=', 'owner')->get();
But I believe that someone must look into this since having() is an inbuilt Laravel function and is not supposed to break when I change the DB.
Please or to participate in this conversation.