From 69061741837ccc9422c6cfa2c0aa35b89ea28103 Mon Sep 17 00:00:00 2001 From: Chris Thompson Date: Tue, 12 Nov 2019 20:02:04 -0500 Subject: [PATCH] Fixes a bug where passed to route() causes errors This attempts to fix #510 even though the example provided by @zsoltgyure isn't actually using route model binding. This bugfix was tested and works with the following. Non-route model binding: ``` {{ Form::open(['route' => ['mytest', [$file->id]]]) }} ``` Another non-route model binding: ``` {{ Form::open(['route' => ['mytest', $file->id]]) }} ``` Multiple models into route model binding: ``` {{ Form::open(['route' => ['manage.files.delete', [$currentPodcast, $file]]]) }} ``` Single model into route model binding: ``` {{ Form::open(['route' => ['manage.podcast.delete', $currentPodcast]]) }} ``` --- src/FormBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FormBuilder.php b/src/FormBuilder.php index f1e9b6d..1060ea4 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -1201,7 +1201,7 @@ class FormBuilder protected function getRouteAction($options) { if (is_array($options)) { - return $this->url->route($options[0], array_slice($options, 1)); + return $this->url->route($options[0], head(array_slice($options, 1))); } return $this->url->route($options);