title: Laravel - delete button
body: <p>Welcome ! I'm new to laravel and i have problem. I start my private project and i want to delete query from database using delete button ( simple todo app). When i click it it doesn't delete but only redirect me to id of this query. Dont know what to do. Can someone help me?</p>
  
  <p>Regards
  tomczas</p>
  
  <p>Destroy function in homecontroller</p>
  
  <pre><code>public function destroy($id)
  {
   $todo = Todo::findOrFail($id);
   $todo-&gt;delete();
  return back();
  
  }
  </code></pre>
  
  <p>home blade</p>
  
  <pre><code>@foreach($todos as $todo)
            &lt;ul class="todo-list"&gt;
              &lt;li&gt;
                &lt;!-- drag handle --&gt;
                    &lt;span class="handle"&gt;
                      &lt;i class="fa fa-ellipsis-v"&gt;&lt;/i&gt;
                      &lt;i class="fa fa-ellipsis-v"&gt;&lt;/i&gt;
                    &lt;/span&gt;
                &lt;!-- checkbox --&gt;
                &lt;input type="checkbox" value=""&gt;
                &lt;!-- todo text --&gt;
                &lt;span class="text"&gt;{{$todo-&gt;tytul}}&lt;/span&gt;
                &lt;!-- Emphasis label --&gt;
                &lt;small class="label label-danger"&gt;&lt;i class="fa fa-clock-o"&gt;&lt;/i&gt; {{$todo-&gt;czas}}&lt;/small&gt;
                &lt;!-- General tools such as edit or delete--&gt;
                &lt;div class="tools"&gt;
                  &lt;i class="fa fa-edit"&gt;&lt;/i&gt;
                  {{Form::open([ 'method'  =&gt; 'DELETE', 'route' =&gt; [ 'home.destroy', $todo ] ])}}
                                  {{ Form::hidden('id', $todo-&gt;id) }}
                                  {{Form::button('&lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;', array('type' =&gt; 'submit', 'class' =&gt; ''))}}
                              {{ Form::close() }}
                  &lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;
                &lt;/div&gt;
              &lt;/li&gt;
  
            &lt;/ul&gt;
            @endforeach
  </code></pre>