Skip to content

Commit

Permalink
Revert "Remove laravel-collection-macros"
Browse files Browse the repository at this point in the history
This reverts commit 4900251
  • Loading branch information
Lukasss93 committed Apr 18, 2023
1 parent 98039fc commit 3b042a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
"ext-json": "*",
"illuminate/support": "^8.0|^9.0|^10.0",
"loilo/fuse": "^6.4.6",
"spatie/simple-excel": "^3.0.1"
"spatie/simple-excel": "^3.0.1",
"spatie/laravel-collection-macros": "^7.12"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0",
"pestphp/pest": "^1.21",
"psalm/plugin-laravel": "^2.0",
"vimeo/psalm": "^4.24"
},
"autoload": {
Expand Down
12 changes: 1 addition & 11 deletions src/LarexServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Lukasss93\Larex;

use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Lukasss93\Larex\Console\LarexExportCommand;
use Lukasss93\Larex\Console\LarexFindCommand;
Expand All @@ -29,23 +28,14 @@ public function boot(): void

/**
* Register services.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/config/larex.php', 'larex');

$this->registerCommands();

Collection::macro('insertAt', function (int $index, $item, $key = null) {
/** @var Collection $this */
$after = $this->splice($index);
$this->items = isset($key)
? $this->put($key, $item)->merge($after)->toArray()
: $this->push($item)->merge($after)->toArray();

return $this;
});
}

protected function registerCommands(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Foundation\Application;
use Lukasss93\Larex\LarexServiceProvider;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Spatie\CollectionMacros\CollectionMacroServiceProvider;

abstract class TestCase extends OrchestraTestCase
{
Expand All @@ -16,6 +17,7 @@ abstract class TestCase extends OrchestraTestCase
protected function getPackageProviders($app): array
{
return [
CollectionMacroServiceProvider::class,
LarexServiceProvider::class,
];
}
Expand Down

0 comments on commit 3b042a4

Please sign in to comment.