laravel controller pass variable to view code example
Example 1: laravel pass variables to view
return view('home')->with('userName',$userName);
Example 2: pass parameter to view laravel
Route::get('/', function () {
return view('greeting', ['name' => 'James']);
});