Utilizing advanced Blade usage
Using Laravel's Blade templating system, we have access to some powerful features that make our development much quicker. For this recipe, we'll pass some data to our blade views and loop through it, along with some conditionals.
Getting ready
For this recipe, we'll need the code created in the Creating a view using Blade recipe .
How to do it...
Follow these steps to complete this recipe:
Open the
routes.php
file and update theblade-home
andblade-second
routes as follows:Route::get('blade-home', function() { $movies = array( array('name' => 'Star Wars', 'year' => '1977', 'slug'=> 'star-wars'), array('name' => 'The Matrix', 'year' => '1999', 'slug' => 'matrix'), array('name' => 'Die Hard', 'year' => '1988', 'slug'=> 'die-hard'), array('name' => 'Clerks', 'year' => '1994', 'slug' => 'clerks') ); return View::make('blade.home')->with('movies', $movies); }); Route::get('blade-second/(:any)', function($slug...