From 2fc07eeaa4923a2681e65c1171bb3c1ba467c41e Mon Sep 17 00:00:00 2001 From: Ibrahim Al Naz Rana Date: Thu, 28 Feb 2019 13:25:36 +0600 Subject: [PATCH] Remove deprecated helper function and use Facade instead --- src/Componentable.php | 3 ++- src/FormBuilder.php | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Componentable.php b/src/Componentable.php index a0a364b..9a227d0 100644 --- a/src/Componentable.php +++ b/src/Componentable.php @@ -3,6 +3,7 @@ namespace Collective\Html; use BadMethodCallException; +use Illuminate\Support\Arr; use Illuminate\Support\HtmlString; trait Componentable @@ -81,7 +82,7 @@ trait Componentable $default = null; } - $data[$variable] = array_get($arguments, $i, $default); + $data[$variable] = Arr::get($arguments, $i, $default); $i++; } diff --git a/src/FormBuilder.php b/src/FormBuilder.php index f28aaba..7889ac7 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -9,6 +9,7 @@ use Illuminate\Contracts\Session\Session; use Illuminate\Contracts\View\Factory; use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; use Illuminate\Support\Facades\App; use Illuminate\Support\HtmlString; @@ -134,7 +135,7 @@ class FormBuilder */ public function open(array $options = []) { - $method = array_get($options, 'method', 'post'); + $method = Arr::get($options, 'method', 'post'); // We need to extract the proper method from the attributes. If the method is // something other than GET or POST we'll use POST since we will spoof the @@ -159,7 +160,7 @@ class FormBuilder // is used to spoof requests for this PUT, PATCH, etc. methods on forms. $attributes = array_merge( - $attributes, array_except($options, $this->reserved) + $attributes, Arr::except($options, $this->reserved) ); @@ -589,9 +590,9 @@ class FormBuilder // If the "size" attribute was not specified, we will just look for the regular // columns and rows attributes, using sane defaults if these do not exist on // the attributes array. We'll then return this entire options array back. - $cols = array_get($options, 'cols', 50); + $cols = Arr::get($options, 'cols', 50); - $rows = array_get($options, 'rows', 10); + $rows = Arr::get($options, 'rows', 10); return array_merge($options, compact('cols', 'rows')); }