Skip to content

Instantly share code, notes, and snippets.

@ashitvora-zz
Created November 21, 2012 11:53
Show Gist options
  • Save ashitvora-zz/4124520 to your computer and use it in GitHub Desktop.
Save ashitvora-zz/4124520 to your computer and use it in GitHub Desktop.
Open form by routes in Laravel
/**
* Open form for a Route
*/
Form::macro('open_by_route', function($route, $params = array(), $attributes = array(), $type = "POST"){
return Form::open( URL::to_route( $route, $params ), $type, $attributes );
});
/**
* Open secure form for a Route
*/
Form::macro('open_secure_by_route', function($route, $params = array(), $attributes = array(), $type = "POST"){
return Form::open_secure( URL::to_route( $route, $params ), $type, $attributes );
});
/**
* Open form for a Route that accepts File
*/
Form::macro('open_for_file_by_route', function($route, $params = array(), $attributes = array(), $type = "POST"){
return Form::open_for_files( URL::to_route( $route, $params ), $type, $attributes );
});
/**
* Open secure form for a Route
*/
Form::macro('open_secure_for_file_by_route', function($route, $params = array(), $attributes = array(), $type = "POST"){
return Form::open_secure_for_files( URL::to_route( $route, $params ), $type, $attributes );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment