diff options
Diffstat (limited to 'src/helpers.php')
-rw-r--r-- | src/helpers.php | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/src/helpers.php b/src/helpers.php index de303963..c3c727ec 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -24,6 +24,15 @@ function app($id = null) } /** + * @param string $path + * @return string + */ +function base_path($path = '') +{ + return app('path') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); +} + +/** * Get or set config values * * @param string|array $key @@ -47,6 +56,15 @@ function config($key = null, $default = null) } /** + * @param string $path + * @return string + */ +function config_path($path = '') +{ + return app('path.config') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); +} + +/** * @param string $key * @param mixed $default * @return Request|mixed @@ -79,22 +97,6 @@ function session($key = null, $default = null) } /** - * @param string $template - * @param mixed[] $data - * @return Renderer|string - */ -function view($template = null, $data = null) -{ - $renderer = app('renderer'); - - if (is_null($template)) { - return $renderer; - } - - return $renderer->render($template, $data); -} - -/** * @param string $path * @param array $parameters * @return UrlGenerator|string @@ -109,3 +111,19 @@ function url($path = null, $parameters = []) return $urlGenerator->to($path, $parameters); } + +/** + * @param string $template + * @param mixed[] $data + * @return Renderer|string + */ +function view($template = null, $data = null) +{ + $renderer = app('renderer'); + + if (is_null($template)) { + return $renderer; + } + + return $renderer->render($template, $data); +} |