From 84c7b3e0b07ce5fa23e5df16a6c7936862499ae0 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Nov 2019 15:20:59 +0000 Subject: [PATCH 1/2] Added head method to router to allow implicit call via HEAD HTTP method --- src/Illuminate/Routing/Router.php | 12 ++++++++++++ src/Illuminate/Support/Facades/Route.php | 1 + 2 files changed, 13 insertions(+) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 2a8051e9a366..04583c064bb4 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -144,6 +144,18 @@ public function get($uri, $action = null) return $this->addRoute(['GET', 'HEAD'], $uri, $action); } + /** + * Register a new HEAD route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function head($uri, $action = null) + { + return $this->addRoute('HEAD', $uri, $action); + } + /** * Register a new POST route with the router. * diff --git a/src/Illuminate/Support/Facades/Route.php b/src/Illuminate/Support/Facades/Route.php index df1d0cfb92e0..351d831658cc 100755 --- a/src/Illuminate/Support/Facades/Route.php +++ b/src/Illuminate/Support/Facades/Route.php @@ -4,6 +4,7 @@ /** * @method static \Illuminate\Routing\Route get(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route head(string $uri, \Closure|array|string|callable|null $action = null) * @method static \Illuminate\Routing\Route post(string $uri, \Closure|array|string|callable|null $action = null) * @method static \Illuminate\Routing\Route put(string $uri, \Closure|array|string|callable|null $action = null) * @method static \Illuminate\Routing\Route delete(string $uri, \Closure|array|string|callable|null $action = null) From 4d096ba4b64b1db6d7d56a129f696e1ed39a43d6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 22 Nov 2019 08:18:02 -0600 Subject: [PATCH 2/2] Update Router.php --- src/Illuminate/Routing/Router.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 04583c064bb4..8e01a2bd5f83 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -133,27 +133,27 @@ public function __construct(Dispatcher $events, Container $container = null) } /** - * Register a new GET route with the router. + * Register a new HEAD route with the router. * * @param string $uri * @param \Closure|array|string|callable|null $action * @return \Illuminate\Routing\Route */ - public function get($uri, $action = null) + public function head($uri, $action = null) { - return $this->addRoute(['GET', 'HEAD'], $uri, $action); - } + return $this->addRoute('HEAD', $uri, $action); + } /** - * Register a new HEAD route with the router. + * Register a new GET route with the router. * * @param string $uri * @param \Closure|array|string|callable|null $action * @return \Illuminate\Routing\Route */ - public function head($uri, $action = null) + public function get($uri, $action = null) { - return $this->addRoute('HEAD', $uri, $action); + return $this->addRoute(['GET', 'HEAD'], $uri, $action); } /**