get(); // Return a JSON response from the serialized results. // return $tasks; return view('tasks.index', compact('name', 'tasks')); }); Route::get('/tasks/{task}', function ($id) { $task = DB::table('tasks')->find($id); // Return a JSON response from the serialized results. // return $tasks; return view('tasks.show', compact('task')); });