Ad

NotFoundHttpException In Laravel 5.1

- 1 answer

my html link code

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{route('blog') }}">Details</a>

my route code

Route::get('blog', array('as' => 'blog', 'uses' => function(){
  return view('blog');
}));

error log

in RouteCollection.php line 161
    at RouteCollection->match(object(Request)) in Router.php line 750
    at Router->findRoute(object(Request)) in Router.php line 659
    at Router->dispatchToRoute(object(Request)) in Router.php line 635
    at Router->dispatch(object(Request)) in Kernel.php line 236
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in 

please help me to find this error.Thanks in advance

Ad

Answer

It looks like your view file is not being parsed as blade template file. The braces only work in blade files so try using just PHP...

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="<?php echo route('blog'); ?>">Details</a>
Ad
source: stackoverflow.com
Ad