From 4abed2f2b3ecb3e671f27d2c753765cef6b331d3 Mon Sep 17 00:00:00 2001 From: Ryan Nielson Date: Tue, 9 Sep 2014 13:04:10 -0300 Subject: [PATCH] Added link helpers from framework --- composer.json | 5 +++- helpers.php | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 helpers.php diff --git a/composer.json b/composer.json index 192fef5..093b364 100755 --- a/composer.json +++ b/composer.json @@ -16,7 +16,10 @@ "autoload": { "psr-4": { "Illuminate\\Html\\": "" - } + }, + "files": [ + "helpers.php" + ] }, "extra": { "branch-alias": { diff --git a/helpers.php b/helpers.php new file mode 100644 index 0000000..fa5bef6 --- /dev/null +++ b/helpers.php @@ -0,0 +1,69 @@ +link($url, $title, $attributes, $secure); + } +} + +if ( ! function_exists('link_to_asset')) +{ + /** + * Generate a HTML link to an asset. + * + * @param string $url + * @param string $title + * @param array $attributes + * @param bool $secure + * @return string + */ + function link_to_asset($url, $title = null, $attributes = array(), $secure = null) + { + return app('html')->linkAsset($url, $title, $attributes, $secure); + } +} + +if ( ! function_exists('link_to_route')) +{ + /** + * Generate a HTML link to a named route. + * + * @param string $name + * @param string $title + * @param array $parameters + * @param array $attributes + * @return string + */ + function link_to_route($name, $title = null, $parameters = array(), $attributes = array()) + { + return app('html')->linkRoute($name, $title, $parameters, $attributes); + } +} + +if ( ! function_exists('link_to_action')) +{ + /** + * Generate a HTML link to a controller action. + * + * @param string $action + * @param string $title + * @param array $parameters + * @param array $attributes + * @return string + */ + function link_to_action($action, $title = null, $parameters = array(), $attributes = array()) + { + return app('html')->linkAction($action, $title, $parameters, $attributes); + } +}