You can pass the content from controller to view in Laravel.
Create Your Data:
create user data array
$userData = ['name' => 'tutorials On Web', 'email' => 'info@tutorialsonweb.com']
1. Using With Method:
This method is commonly used and allows you to pass data in view
return view('your.view.name')->with('data', $yourData);
In your view, you can access $data as a variable containing $yourData.
2. Using an Array:
You can pass an array of data to the view as well.
return view('your.view.name', ['data' => $yourData]);
3. Using compact Function:
If the variable names in your controller match the variable names in your view, you can use the compact function.
return view('your.view.name', compact('data'));
4. Access Data in the View:
<p>Name: {{ $userData['name'] }}</p>
<p>Email: {{ $userData['email'] }}</p>