1// First way ->with() 2return view('index') 3 ->with('projects', $projects) 4 ->with('tasks', $tasks) 5 6// Second way - as an array 7return view('index', [ 8 'projects' => $projects, 9 'tasks' => $tasks10 ]);11 12// Third way - the same as second, but with variable13$data = [14 'projects' => $projects,15 'tasks' => $tasks16];17return view('index', $data);18 19// Fourth way - the shortest - compact()20return view('index', compact('projects', 'tasks'));