Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anonymouse703's avatar

Online API route doesn't load data.

Hello everyone, I try to get data from API route in my online app but return null but when I tried to access my API route locally it will load data..

When I try to hit this in my local http://www.notification.test/api/notifications-get?app_code=iaccs

This will be the return:

[{"id":1,"app_code":"iaccs","data":"\"{data:'value'}\"","message":"New Update","custom_message":"Update notification sent","read_at":null,"created_at":"2019-01-12 07:23:10","updated_at":"2019-01-12 07:23:10"},{"id":2,"app_code":"iaccs","data":"\"{data:'value'}\"","message":"Nesdasda","custom_message":"Update nawala","read_at":null,"created_at":"2019-01-12 07:25:04","updated_at":"2019-01-12 07:25:04"},{"id":3,"app_code":"iaccs","data":"\"{data:'value'}\"","message":"New new","custom_message":"Update nawala","read_at":null,"created_at":"2019-01-12 07:27:05","updated_at":"2019-01-12 07:27:05"},{"id":4,"app_code":"iaccs","data":"\"{data:'value'}\"","message":"New errror","custom_message":"error","read_at":null,"created_at":"2019-01-12 07:30:09","updated_at":"2019-01-12 07:30:09"},{"id":5,"app_code":"iaccs","data":"\"{data:'value'}\"","message":"New errrorsssssss","custom_message":"error niiiii","read_at":null,"created_at":"2019-01-12 07:31:29","updated_at":"2019-01-12 07:31:29"},{"id":6,"app_code":"iaccs","data":"\"{test:'value'}\"","message":"sample message","custom_message":"sample custom message","read_at":null,"created_at":"2019-01-12 07:37:27","updated_at":"2019-01-12 07:37:27"}]

But when I hit in online (Production) http://35.246.184.134/api/notifications-get?app_code=iaccs

The result is Blank... There's no data.

How to solve it?

0 likes
5 replies
ImeDa's avatar
ImeDa
Best Answer
Level 3

@anonymouse703 change your APP_DEBUG variable to true in your .env file, also read the laravel.log file, there should be error printed. If u r new to terminal, u can see the output of the log file like so:

sudo tail -500 storage/logs/laravel.log

If u wanna see the output of the log file in real time, run this:

sudo tail -f storage/logs/laravel.log
douglasakula's avatar

@anonymouse703

Best place to start is server error logs. You could be missing an extension that is installed in your local server or your remote laravel installation needs a package update or install thats already installed on your local server. To rule out laravel packages - you can run composer update on remote server. To rule out server extensions - which looks the most probable cause - enable debug on remote host to see if there are any errors - and check server logs as well - there must be something somewhere.

If on apache with root access - you can type this in terminal to view apache error logs

sudo su

tail -15 /var/log/apache2/error.log
ImeDa's avatar

@DOUGLASAKULA - 1 correction to your answer, don't sudo su, in that way u r switching to root user and may easily end up in crashing the whole droplet (vps or whatever you are using).

Please or to participate in this conversation.