laravel pass value from controller to view code example
Example 1: passing data from controller to blade view laravel
public function index(Request $request)
{
....
return view('pages.eventPage', compact('id', 'event', 'n'));
}
Example 2: pass parameter to view laravel
Route::get('/', function () {
return view('greeting', ['name' => 'James']);
});