Reputation: 1621
my html link code
<a 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
Upvotes: 0
Views: 216
Reputation: 696
Try clearing the route cache by running the
php artisan route:clear
command and see if the route actually exists with php artisan route:list
Also, the "uses" keyword is not necessary in this example
Route::get('blog', array('as' => 'blog', function(){
return view('blog');
}));
If that doesn't help, then we're going to need the full routes file, because everything seems to be ok here.
Upvotes: 1
Reputation: 961
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 href="<?php echo route('blog'); ?>">Details</a>
Upvotes: 1
Reputation: 7165
Try using:
<a href="{{url('blog') }}">Details</a>
instead of the current: <a href="{{route('blog') }}">Details</a>
Upvotes: 1