0

This works fine:

Route::get('blade-second', function()
{
  $slug = 'star-wars';
  $movies = array(
    'star-wars' => array('name' => 'Star Wars', 'year'
     => '1977', 'genre' => 'Sci-Fi'),
    ...
  );
  return View::make('blade.second')->with('movie', $movies[$slug]);
});

but replace it with this:

Route::get('blade-second/(:any)', function($slug)
{
  $movies = array( ... );

  return View::make('blade.second')->with('movie', $movies[$slug]);
});

and it results in a 200 NotFoundHttpException.

2 Answers 2

1

If this is Laravel 4, that syntax is no longer valid and you should use the style listed in the documentation: http://laravel.com/docs/routing.


1
  • Aha! So perhaps my Cookbook example is out of date. Though that's a bit strange, it's meant to be for Laravel 4.0 as far as I can tell. I've installed Laravel 4.1, would that make a difference? Mar 31, 2014 at 14:32
0

try to use brackets, and no colon

'blade-second/{any}'
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.