diff --git a/composer.json b/composer.json index f75db00..67f6978 100644 --- a/composer.json +++ b/composer.json @@ -23,13 +23,13 @@ } ], "require": { - "illuminate/view": "^5.5|^6", - "illuminate/support": "^5.5|^6", - "illuminate/console": "^5.5|^6", - "illuminate/contracts": "^5.5|^6", - "illuminate/http": "^5.5|^6", - "illuminate/database": "^5.5|^6", - "illuminate/pagination": "^5.5|^6" + "illuminate/view": "^5.5|^6|^8", + "illuminate/support": "^5.5|^6|^8", + "illuminate/console": "^5.5|^6|^8", + "illuminate/contracts": "^5.5|^6|^8", + "illuminate/http": "^5.5|^6|^8", + "illuminate/database": "^5.5|^6|^8", + "illuminate/pagination": "^5.5|^6|^8" }, "suggest": { "maatwebsite/excel": "For exporting grid data as excel (~3.0)", diff --git a/src/Buttons/GenericButton.php b/src/Buttons/GenericButton.php index 79deb8c..c88659c 100644 --- a/src/Buttons/GenericButton.php +++ b/src/Buttons/GenericButton.php @@ -7,6 +7,7 @@ namespace Leantony\Grid\Buttons; use Illuminate\Contracts\Support\Htmlable; +use Illuminate\Support\Arr; use InvalidArgumentException; class GenericButton implements Htmlable @@ -352,7 +353,7 @@ public function render(...$args) // collapse the array of args into a single 1d array, so that the values passed can be // accessed as key value pair - $args = array_collapse($args); + $args = Arr::collapse($args); return view($this->getButtonView(), $this->compactData($args))->render(); } diff --git a/src/Buttons/RendersButtons.php b/src/Buttons/RendersButtons.php index 7eab976..341f2ec 100644 --- a/src/Buttons/RendersButtons.php +++ b/src/Buttons/RendersButtons.php @@ -6,6 +6,8 @@ namespace Leantony\Grid\Buttons; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; use InvalidArgumentException; trait RendersButtons @@ -251,7 +253,7 @@ public function hasButtons(string $section = 'toolbar') return false; } // no buttons on section - return count(array_get($this->buttons, $section, [])) === 0 ? false : true; + return count(Arr::get($this->buttons, $section, [])) === 0 ? false : true; } /** @@ -303,7 +305,7 @@ protected function makeCustomButton(array $properties, $position = null): Generi */ protected function makeButtonKey(string $name) { - return str_slug($name); + return Str::slug($name); } /** diff --git a/src/Commands/GenerateGrid.php b/src/Commands/GenerateGrid.php index 3a0ca0f..23b66c7 100644 --- a/src/Commands/GenerateGrid.php +++ b/src/Commands/GenerateGrid.php @@ -9,6 +9,7 @@ use Illuminate\Console\Command; use Illuminate\Database\Eloquent\Model; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Arr; use Illuminate\Support\Str; use Leantony\Grid\HasGridConfigurations; @@ -104,10 +105,10 @@ public function handle() die(-1); } - list($model, $rows) = $this->generateRows($suppliedModel); + [$model, $rows] = $this->generateRows($suppliedModel); // binding - list($namespace, $replaced, $filename) = $this->dumpBinding($model); + [$namespace, $replaced, $filename] = $this->dumpBinding($model); // class $this->dumpClass($model, $rows, $stub); @@ -263,7 +264,7 @@ protected function dumpBinding($model): array { $stub = __DIR__ . '/../Stubs/GridInterface.txt'; - list($namespace, $interfaceName, $replaced) = $this->makeReplacementsForBinding($model, + [$namespace, $interfaceName, $replaced] = $this->makeReplacementsForBinding($model, $this->generateDynamicNamespace(), $stub); $this->binding = $interfaceName; @@ -396,7 +397,7 @@ protected function makeDirectory($path) */ protected function dumpClass($model, $rows, $stub) { - list($namespace, $tableName, $replaced) = $this->makeReplacements($model, $rows, $stub); + [$namespace, $tableName, $replaced] = $this->makeReplacements($model, $rows, $stub); $filename = $this->makeFileName($tableName . 'Grid'); @@ -466,7 +467,7 @@ protected function replaceRows($rows, $stub) */ protected function replaceOtherContent(array $replacements, &$stub) { - $replaced = str_replace(array_values(array_except($this->searches, 'rows')), [ + $replaced = str_replace(array_values(Arr::except($this->searches, 'rows')), [ $replacements['namespace'], $replacements['modelName'], $replacements['tableName'], diff --git a/src/Events/UserActionRequested.php b/src/Events/UserActionRequested.php index fd96829..ff9c50b 100644 --- a/src/Events/UserActionRequested.php +++ b/src/Events/UserActionRequested.php @@ -7,6 +7,7 @@ namespace Leantony\Grid\Events; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Leantony\Grid\Grid; use Leantony\Grid\GridInterface; @@ -51,6 +52,6 @@ public function __construct(GridInterface $grid, Request $request, $builder, $va $this->request = $request; $this->builder = $builder; $this->validTableColumns = $validTableColumns; - $this->args = array_collapse($args); + $this->args = Arr::collapse($args); } } \ No newline at end of file diff --git a/src/Filters/GenericFilter.php b/src/Filters/GenericFilter.php index 770bda3..25428fe 100644 --- a/src/Filters/GenericFilter.php +++ b/src/Filters/GenericFilter.php @@ -7,6 +7,7 @@ namespace Leantony\Grid\Filters; use Illuminate\Contracts\Support\Htmlable; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; use InvalidArgumentException; @@ -159,11 +160,11 @@ public function render() // all filters apart from dropdowns are rendered as text elements. // css classes or js libraries can be used to change this return view('leantony::grid.filters.text', $this->compactData( - array_collapse(func_get_args()) + Arr::collapse(func_get_args()) ))->render(); case 'select': return view('leantony::grid.filters.dropdown', $this->compactData( - array_collapse(func_get_args()) + Arr::collapse(func_get_args()) ))->render(); default: throw new \Exception("Unknown filter type.");