/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $todos = Todo::orderBy('created_at', 'DESC')->paginate(5)->toArray(); $remaining = Todo::where('completed', 0)->count(); return ['todos' => $todos, 'remaining' => $remaining]; }