I've been banging my head all day and can't seem to figure this one out.
I have this code:
public function getUsers()
{
$company_id = 21;
$users = User::with('user_details',
'user_details.department',
'user_details.payroll_group',
'user_details.shift_group',
'user_details.updated_by')
->with('deductions')
->with('allowances')
// ->with('shifts')
->where('company_id', $company_id)
->get();
foreach ($users as $key => $user) {
$user->getFirstMedia('images');
if(isset($user->media[0])){
$users[$key]->media[0]->url = $user->media[0]->getFullUrl();
}
$users[$key]['user_salary'] = UserSalary::getCurrentRate($user->id);
}
return response()->json($users, 200);
}
It seems that everytime that $company_id
has a value of 21
my server always response is empty. BUT if not, it returns as what I've expected.
I tried it in postman, this is the result:
I also tried running curl
in my server, it responds this one:
curl: (52) Empty reply from server
I've checked laravel.log
, there's no error.
I've checked /var/log/apache2/error.log
, there's no error also.
I ran out of ideas how to solve this one.
Help me, please! Thanks.
PS: I don't know if i should post this one here or at ServerFault, but here it goes.