Laravel Authentication

1

I am studying the authentication part of Laravel and based on the following documentation Laravel

I followed all the steps:

  • I configured the database
  • I put the routes
  • I've placed Views

When I log in to: ( link ) it opens the form to register new users, but when I click "Register"

Give the following error:

  

Not Found The requested URL / auth / register was not found on this   server.

I saw that this is redirecting me to: ( link )

I tried to use the route(...) helper but as this was not in the official documentation I thought I'd better ask you here ...

Has anyone ever followed these steps and had the same problem? and have the solution?

    
asked by anonymous 19.10.2016 / 04:58

1 answer

0

To start with the scaffold for Laravel authentication, run the following command on the console:

php artisan make:auth

This will create standard views for registration and login, as well as authentication middleware, along with a group of routes. All you have to do is put the protected routes within that group.

Example:

Route::get('/', function () {
        return view('home.home', ['nav' => "home"]);
});


Route::group(['middleware' => ['auth']], function () {
    Route::group(['prefix' => 'products'], function () {
        Route::get('/', 'ProductController@getAll');
        Route::get('/ajax', 'ProductController@getAllAjax');
        Route::get('/stock/danger', 'ProductController@getStockDanger');
        Route::get('/ajax/{id}', 'ProductController@getOne');
        Route::post('/store', 'ProductController@store');
        Route::get('/delete/{id}', 'ProductController@deleteView');
        Route::get('/destroy/{id}', 'ProductController@destroy');
        Route::get('/edit/{id}', 'ProductController@editView');
        Route::post('/update', 'ProductController@update');
        Route::post('/search', 'ProductController@search');
        Route::get('/{id}', 'ProductController@detail');
});
Route::auth();

In this case the route that redirects to / is published while the group within Route::group(['middleware' => ['auth']], function () {}); requires authentication. This is done from the users table created by Laravel himself.

    
19.10.2016 / 12:11