I believe the issue might be that Postgres Does not work well with like, as for Postgres like is case sensitive while for MySQL is by default Case Insensitive. Postgres has ilike for case insensitive but that does not work with mySQL...
Try using whereRaw instead. For Example:
$query = Book::whereRaw('LOWER(judul) like ?', "%$keyword%")
->orWhereRaw('LOWER(label) like ?', "%$keyword%")
...
This has worked for me on Heroku with no problems.
Also, I advise:
- Testing the code 1 by 1, as you add more conditions to see if it fails anywhere else
- Install and enable debugbar so you can see the query that is being executed on Heroku-side
- Install HeidiSQL which has a PostgreSQL Connection Option. I have found it useful to get the Query executed from DebugBar, and execute it on HeidiSQL to get more information on where the code was failing.
Edit:
Notice that the Keyword also needs to be lowercase. So somewhere you need to:
$keyword = strtolower(trim($keyword));