Reputation: 1617
If I type carfreak/owner
into my browser, the expected view comes up. An artisan route:list
all looks good, and the fact the browser finds it means the route is working.
If I put any of the following, into my controller, I get route [...] not defined
return redirect()->route('owner');
return redirect()->route('/owner');
return redirect()->route('carfreak/owner');
What have I missed? Laravel documentation says it should work: https://laravel.com/docs/5.2/routing#named-routes
EDIT:
return redirect('owner')
works just fine. Upvotes: 0
Views: 46
Reputation: 1279
I think that you can't use return redirect()->route('/owner');
or return redirect()->route('carfreak/owner');
If you redirect to a route then you need to pass route name which you set in your routes file by making 'as' => 'routename'
and not use the route adress inside route redirect.
Upvotes: 1