laravel pass variable to view from controller with all functions code example Example: laravel pass variables to view return view('home')->with('userName',$userName);