blob: 6df52425753b7d404dcc31f6570e89834d4cf73a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php
namespace Engelsystem\Routing;
class UrlGenerator
{
/**
* @param string $path
* @param array $parameters
* @return string
*/
public function to($path, $parameters = [])
{
$path = '/' . ltrim($path, '/');
$request = app('request');
$uri = $request->getUriForPath($path);
if (!empty($parameters) && is_array($parameters)) {
$parameters = http_build_query($parameters);
$uri .= '?' . $parameters;
}
return $uri;
}
}
|