get(); $tasks = Task::all(); // 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); $task = Task::find($id); // Return a JSON response from the serialized results. // return $tasks; return view('tasks.show', compact('task')); });