how to configure routes in laravel 5.3?

0

I'm studying more on my own Laravel, but I already looked at his documentation on routes and I can not make it work here.

I did a little test:

Route::get('/', function () {
    return view('welcome');
});

Route::get('teste', function() {
    return view('teste');
});

and I created the file teste.blade.php in the resources/views/teste.blade.php this is along with the file welcome.blade.php , where it works without problems, but when I put it in the browser dev.project/teste it does not find the file. but if you put dev.project/ it opens the welcome file.

Can anyone tell me if I'm missing a configuration, or maybe I have to create a controller file to run?

    
asked by anonymous 26.12.2017 / 23:39

1 answer

1

As mentioned in the comments, the correct thing is you create a Controller and there you prepare the data to send to the view. Example:

Route:

Route::get('/teste', ['as'=>'teste.index', 'uses'=> 'TesteController@index']);

Controller:

public function index(){
    return view('teste.index');
}
    
27.12.2017 / 13:40