I'm trying to learn Laravel 4 and reading the book called Laravel: code bright
I'm trying to pass array data from routes to view but I get this error
ErrorException Undefined variable: squirrel
Codes are like these. Same as in the book.
url localhost/test
routes.php
<?php
Route::get('/{squirrel}', function() {
$data['squirrel'] = $squirrel;
return View::make('simple', $data);
});
?>
simple.php
<!DOCTYPE html>
<html lang="eng">
<head>
<meta charset="UTF-8">
<title>Views!</title>
</head>
<body>
<p>I wish I were a <?php echo $squirrel; ?> squirrel!</p>
</body>
</html>