Skip to content

Commit 7a3e932

Browse files
committed
add route func
1 parent 9e91e1e commit 7a3e932

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

core/functions/laravel.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
use Illuminate\Contracts\Cookie\Factory as CookieFactory;
3+
use Illuminate\Contracts\Cookie\Factory as CookieFactory;
44
use Illuminate\Contracts\Routing\ResponseFactory;
55
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
66

@@ -310,6 +310,21 @@ function response($content = '', $status = 200, array $headers = [])
310310
}
311311
}
312312

313+
if (! function_exists('route')) {
314+
/**
315+
* Generate the URL to a named route.
316+
*
317+
* @param array|string $name
318+
* @param mixed $parameters
319+
* @param bool $absolute
320+
* @return string
321+
*/
322+
function route($name, $parameters = [], $absolute = true)
323+
{
324+
return app('url')->route($name, $parameters, $absolute);
325+
}
326+
}
327+
313328
if (! function_exists('session')) {
314329
/**
315330
* Get / set the specified session value.

core/src/Core.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ public function initialize()
232232
$this->checkAuth();
233233
$this->getSettings();
234234
$this->q = UrlProcessor::cleanQueryString(is_cli() ? '' : get_by_key($_GET, 'q', ''));
235+
236+
$routes = $this->router->getRoutes();
237+
$routes->refreshNameLookups();
238+
$routes->refreshActionLookups();
235239
}
236240

237241
final public function __clone()

0 commit comments

Comments
 (0)