summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-09-20 01:09:11 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2017-09-20 01:10:14 +0200
commit86c0713baa2f616bf1dff6d9dbe0ea68b1c00e91 (patch)
tree9f1c0a43c6c02b333059e2e5b30334f7465ab5d6 /src
parentc8d32d23e195d53d6d10fdac5003718b10ffbeaa (diff)
Added helpers unit test
Diffstat (limited to 'src')
-rw-r--r--src/Routing/UrlGenerator.php2
-rw-r--r--src/helpers.php14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/Routing/UrlGenerator.php b/src/Routing/UrlGenerator.php
index 33eef7b0..6df52425 100644
--- a/src/Routing/UrlGenerator.php
+++ b/src/Routing/UrlGenerator.php
@@ -9,7 +9,7 @@ class UrlGenerator
* @param array $parameters
* @return string
*/
- public static function to($path, $parameters = [])
+ public function to($path, $parameters = [])
{
$path = '/' . ltrim($path, '/');
$request = app('request');
diff --git a/src/helpers.php b/src/helpers.php
index b942068f..de303963 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -69,7 +69,7 @@ function request($key = null, $default = null)
*/
function session($key = null, $default = null)
{
- $session = request()->getSession();
+ $session = app('session');
if (is_null($key)) {
return $session;
@@ -97,9 +97,15 @@ function view($template = null, $data = null)
/**
* @param string $path
* @param array $parameters
- * @return string
+ * @return UrlGenerator|string
*/
-function url($path, $parameters = [])
+function url($path = null, $parameters = [])
{
- return UrlGenerator::to($path, $parameters);
+ $urlGenerator = app('routing.urlGenerator');
+
+ if (is_null($path)) {
+ return $urlGenerator;
+ }
+
+ return $urlGenerator->to($path, $parameters);
}