send data to view on controller compact larave; 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']);
});