I have an API endpoint to return all the messages. I am using resources for that. From my local database I can do that very conveniently. Now I have switched to firebase for realtime connection. So my resource is not working. can anyone help me out in this scenario?
Resource code:
return [
'text' => $this->message,
'created_at' => $this->created_at->setTimezone('Asia/Kuala_Lumpur')->format('Y-m-d H:i:s'),
'status' => $this->status,
'replied_by' => $replied_by,
'author' => $this->findAuthorInfo()
];
Controller code:
$firestore = app('firebase.firestore');
$database = $firestore->database();
$c = $database->collection('collection')->where('user_id', '=', Auth::guard('api')->user()->id);
return [
'success' => true,
'message' => 'Messages',
'data' => UserMessageResource::collection($c)
];