Laravel error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException Laravel error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException laravel laravel

Laravel error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException


Actually you should use (Remove $ from {$slug}):

Route::get('/posts/{slug}', array(    'as' => 'post-show',    'uses' => 'PostController@getShow'));

Also change:

<a href="{{ URL::action('post-show', $post->slug) }}">Read more →</a>

To this:

<a href="{{ URL::route('post-show', $post->slug) }}">Read more →</a>

Or use route helper function:

<a href="{{ route('post-show', $post->slug) }}">Read more →</a>


URL::action (as the name implies) expects an action, not a route name as you're passing.

public string action(string $action, mixed $parameters = array(), bool $absolute = true)

You should use route():

URL::route('post-show', array($post->slug))

public string route(string $name, mixed $parameters = array(), bool $absolute = true, Route $route = null)