laravel pass variables to view
snippet in php

laravel pass variables to view

user6199

return view('home')->with('userName',$userName);

pass parameter to view laravel

user3932

Route::get('/', function () {
    return view('greeting', ['name' => 'James']);
});