2
I’m having trouble with a link I created in a view directing to a route. Follow the error:
Errorexception
Route [/user/addUser] not defined
.(View: /var/www/projeto/app/views/principal/index.blade.php)
Routes:
Route::get('/', function()
{
return View::make('principal.index');
});
Route::get('/user/adduser','Adminusercontroller@adduser');
Controller:
class AdminUserController extends BaseController {
public function __construct(){
parent::__construct;
}
public function addUser()
{
return View::make('user.addUser');
}
}
View:
@extends('layout.main')
@section('header')
<a href="{{URL::route('/user/addUser')}}"><button class= "btn btn-primary">Novo Cadastro</button></a>
@stop
@section('content')
@stop
@section('footer')
@stop
TL;DR: For unnamed routes use URL::to('route'); For named routes use URL::route('route name');
– FReNeTiC