public function show($taid = 'all') { if ($taid == 'all') { $topics = TopicAnswer::all()->toArray(); return Response::make(['success' => true, 'data' => $topics]); } else { try { $answer = TopicAnswer::findOrFail($taid); $answer->topic->toArray(); return Response::make(['success' => true, 'data' => $answer]); } catch (Exception $e) { return Response::make(['error' => true, 'message' => 'Sorry but that topic cannot be found!', 'data' => null], 404); } } }