Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to Passing Data to Views ?

Answer Posted / rachana devi

While building application it may be required to pass data to the views.
Pass an array to view helper function.
After passing an array, we can use the key to get the value of that key in the HTML file.

Example :

Observe the following example to understand more about passing data to views -
Copy the following code and save it at resources/views/test.php

<html>
<body>
<h1><?php echo $name; ?></h1>
</body>
</html>

Add the following line in app/Http/routes.php file to set the route for the above view.
app/Http/routes.php

Route::get('/test', function(){
return view('test',[‘name’=>’Virat Gandhi’]);
});

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is helper in laravel?

676


What encryption does laravel use?

661


Explain laravel service container?

618


What is chunk in laravel?

707


What is laracasts?

728


List the default ports that are forwarded to your homestead environment?

611


Explain response in laravel.

725


How to redirect user with flashed session data in laravel?

670


Tell me why doesn't laravel use semantic versioning?

677


What is a laravel controller?

813


How do laravel facades work?

717


How can we use middleware in laravel?

666


Explain laravel query builder?

651


What is service container in laravel?

687


Does laravel use mvc?

659