Skip to content

Instantly share code, notes, and snippets.

@diegofelix
Last active January 2, 2016 14:09
Show Gist options
  • Save diegofelix/8314644 to your computer and use it in GitHub Desktop.
Save diegofelix/8314644 to your computer and use it in GitHub Desktop.
Laravel 4: Delete Form Macro
<?php
/*
|--------------------------------------------------------------------------
| Delete form macro
|--------------------------------------------------------------------------
|
| This macro creates a form with only a submit button.
| We'll use it to generate forms that will post to a certain url with the DELETE method,
| following REST principles.
|
*/
Form::macro('delete',function($form_parameters, $button_label, $button_options = null){
$form_parameters['method'] = 'DELETE';
return Form::open($form_parameters)
. Form::submit($button_label, $button_options)
. Form::close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment