I am working on several tutorials for Laravel 4, and I ran into a problem that I cannot understand or understand why it does not work correctly.
What I'm trying to do is make a route that looks at the url and then works on it logically. Here is my current code:
Route::get('/books/{genre?}', function($genre) { if ($genre == null) return 'Books index.'; return "Books in the {$genre} category."; });
So, if the URL is http://localhost/books , the page should return a Books index. If the URL reads http://localhost/books/mystery , the page should return "Books in the category of mystery."
However, I get "Missing argument 1 for error {close} ()". I even referred to the Laravel documentation, and their parameters were configured exactly the same. Any help would be appreciated.
source share