From 169cfbc796c2472ab4424d3044b7984290ec0dfe Mon Sep 17 00:00:00 2001 From: "Shea Lewis (Kai)" Date: Thu, 5 Sep 2019 12:45:04 -0700 Subject: [PATCH] Remove deprecated Laravel helpers --- src/Builder.php | 9 +++++---- src/Item.php | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 581cb4a..5fc5bd3 100755 --- a/src/Builder.php +++ b/src/Builder.php @@ -2,6 +2,7 @@ namespace Caffeinated\Menus; use BadMethodCallException; +use Illuminate\Support\Arr; use Illuminate\Support\Str; class Builder @@ -92,7 +93,7 @@ public function extractAttributes($options = array()) $options = $this->mergeWithLastGroup($options); } - return array_except($options, $this->reserved); + return Arr::except($options, $this->reserved); } return array(); @@ -132,7 +133,7 @@ public function config($key) public function getLastGroupPrefix() { if (count($this->groupStack) > 0) { - return array_get(last($this->groupStack), 'prefix', ''); + return Arr::get(last($this->groupStack), 'prefix', ''); } return null; @@ -146,12 +147,12 @@ public function getLastGroupPrefix() public static function formatGroupClass($new, $old) { if (isset($new['class'])) { - $classes = trim(trim(array_get($old, 'class')).' '.trim(array_get($new, 'class'))); + $classes = trim(trim(Arr::get($old, 'class')).' '.trim(Arr::get($new, 'class'))); return implode(' ', array_unique(explode(' ', $classes))); } - return array_get($old, 'class'); + return Arr::get($old, 'class'); } /* diff --git a/src/Item.php b/src/Item.php index 14b16dc..016c2e8 100755 --- a/src/Item.php +++ b/src/Item.php @@ -1,6 +1,8 @@ builder = $builder; $this->id = $id; $this->title = $title; - $this->slug = camel_case(str_slug($title, ' ')); + $this->slug = Str::camel(Str::slug($title, ' ')); $this->attributes = $this->builder->extractAttributes($options); $this->parent = (is_array($options) and isset($options['parent'])) ? $options['parent'] : null; @@ -83,7 +85,7 @@ public function configureLink($options) } elseif (isset($options['raw']) and $options['raw'] == true) { $path = null; } else { - $path = array_only($options, ['url', 'route', 'action', 'secure']); + $path = Arr::only($options, ['url', 'route', 'action', 'secure']); } if (! is_null($path)) {