Js and Laravel The page has expired due to inactivity

0

I have the following form in java and I do not know how to make Laravel detect the crsf.

                    <form method="post" action="/turnos/${data.id}">

                        <input type="hidden" name="_token" value="csrf_token()"> 
                        <input type="hidden" name="_method" value="delete" />

                        <a href="/turnos/${data.id}" rel="tooltip" title="Ver detalle" class="btn btn-info btn-simple btn-xs" >
                            <span class="oi oi-info"></span>                      
                        </a>
                        <a href="/turnos/${data.id}/edit" rel="tooltip" title="Editar" class="btn btn-success btn-simple btn-xs" >
                            <span class="oi oi-pencil"></span>                           
                        </a>                                
                        <button type="submit" rel="tooltip" title="Borrar" class="btn btn-danger btn-simple btn-xs">
                            <span class="oi oi-trash"></span>                            
                        </button>
                    </form>
    
asked by Segurida IT 13.04.2018 в 07:50
source

1 answer

0

To declare the csrf_field in Laravel you can do it in any of the following ways:

Laravel 5.5 or lower

<input type="hidden" name="_token" value="{{ csrf_token() }}">

or also like this:

{{ csrf_field() }}

As you can see in the previous example, what you need is the syntax of the double blade keys when declaring the csrf_token

Or if your version of Laravel is 5.6; You can do it as follows:

@csrf
    
answered by 13.04.2018 в 13:18