Reputation: 73
`
return $all_user = DB::select("SELECT *,
'STATUS' AS STAT,
CASE
WHEN TIMESTAMPDIFF(MINUTE, updated_at, NOW()) <= 1 THEN 'online'
WHEN (TIMESTAMPDIFF(MINUTE, updated_at, NOW()) > 720
AND TIMESTAMPDIFF(MINUTE, updated_at, NOW()) <= 30) THEN 'idle'
ELSE 'offline'
END AS user_status
FROM users")->paginate(20);
`
I'm expecting the result with paginate link. when i put
->paginate(20)
it giving me Call to a member function paginate() on array error. please help
Upvotes: 0
Views: 79
Reputation: 558
maybe you can use:
return $all_user = DB::table('users')
->select(" *,
'STATUS' AS STAT,
CASE
WHEN TIMESTAMPDIFF(MINUTE, updated_at, NOW()) <= 1 THEN 'online'
WHEN (TIMESTAMPDIFF(MINUTE, updated_at, NOW()) > 720
AND TIMESTAMPDIFF(MINUTE, updated_at, NOW()) <= 30) THEN 'idle'
ELSE 'offline'
END AS user_status
FROM users")->paginate(20);
Upvotes: 2