Passing Data from Route to View
The data should be an array with key / value pairs. Inside your view, you can then access each value using its corresponding key.
Example 1:-
Route::get('contact', function () {
return view('contactme', ['name' => 'Sonam']);
});
Example 2:-
Route::view($contact, “contactme', ['name' => 'Sonam']);
Passing Data from Route to View
You may use the with method to add individual pieces of data to the view..
Example:-
Route::get('contact', function () {
return view(ʻcontactme') =>with('name', 'Sonam')
});
Accesing data which is passed frokm ropute to view
{{$name}}
0 Comments
Please do not enter any spam link in comment box.