Details

      Description

      Return the user-desired HTTP method, if given. Otherwise, return the CGI.REQUEST_METHOD, as usual.

      See https://laravel.com/docs/5.2/routing#form-method-spoofing

      This will introduce no breaking issues while making it possible for normal forms to follow RESTful routing guidelines.

      HTTP Verb Path Handler@Action Used For
      GET /posts posts@index Displays a list of all posts
      GET /posts/new posts@new Returns an HTML form for creating a new post
      POST /posts posts@create Creates a new post
      GET /posts/:id posts@show Displays a specific post
      GET /posts/:id/edit posts@edit Returns an HTML form for editing a post
      PATCH/PUT /posts/:id posts@update Updates a specific post
      DELETE /posts/:id posts@destroy Deletes a specific post
      <form method="POST" action="#event.buildLink( 'posts.#post.getId()#' )#">
          <input type="hidden" name="_method" value="DELETE" />
         <button type="submit">Delete</button>
      </form>
      
      <!--- Instead of --->
      
      <form method="POST" action="#event.buildLink( 'posts.#post.getId()#.delete' )#">
         <button type="submit">Delete</button>
      </form>
      

      The HTMLHelper has been updated as well:

      // Some comments here
      #html.startForm( action = "posts.#prc.post.getId()#", method="DELETE" )#
          #html.submitButton( name = "Delete", class = "btn btn-danger" )#
      #html.endForm()#
      
      <!--- will output --->
      
      <form action="http://localhost/posts/1" method="POST">
          <input type="hidden" name="_method" value="DELETE" />
          <input type="submit" name="Delete" value="Submit" class="btn btn-danger" id="Delete"/>
      </form>
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                elpete Eric Peterson
                Reporter:
                elpete Eric Peterson
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: