What does the point on a laravel route mean?

1

For example, in this code I see that route is like this: "pedidos3.create"

{!!Form::open(['route'=>'pedidos3.create','method'=>'GET','class'=>'form-horizontal form-label-left input_mask','name'=>'sumar']) !!}

but the route is only like this:

Route::resource('pedidos3', 'PedidosController@create');
    
asked by lucho 16.07.2017 в 19:29
source

1 answer

0

The point as such does not mean anything in particular, it is a Laravel convention to separate the name of the set of routes or the controller and the action performed by the method. But it can be "casa.auto" or "micasa" and it will also work, it's just a name that is defined along with the route.

By using Route::resource you are telling Laravel to create the entire set of routes related to CRUD.

If you do Route::resource('photos', 'PhotosController'); , Laravel will generate the following routes:

Verbo       URI                     Acción  Nombre ruta
GET         /photos                 index   photos.index
GET         /photos/create          create  photos.create
POST        /photos                 store   photos.store
GET         /photos/{photo}         show    photos.show
GET         /photos/{photo}/edit    edit    photos.edit
PUT/PATCH   /photos/{photo}         update  photos.update
DELETE      /photos/{photo}         destroy photos.destroy

The correct way to use Route :: resource is without specifying the method, simply the controller:

Route::resource('pedidos3', 'PedidosController');

You can find all the information in the documentation:

link

    
answered by 16.07.2017 / 19:52
source