spatie/laravel-settings

Install failed config('settings.settings') returning null

TheMutabor opened this issue · 2 comments

Hi,

i just installed laravel settings on my app, but i got this error:

composer require spatie/laravel-settings
Using version ^2.1 for spatie/laravel-settings
./composer.json has been updated
Running composer update spatie/laravel-settings
Loading composer repositories with package information
Updating dependencies
Lock file operations: 8 installs, 0 updates, 0 removals
  - Locking composer/package-versions-deprecated (1.11.99.1)
  - Locking doctrine/cache (1.11.0)
  - Locking doctrine/dbal (3.1.0)
  - Locking doctrine/deprecations (v0.5.3)
  - Locking doctrine/event-manager (1.1.1)
  - Locking spatie/data-transfer-object (2.8.3)
  - Locking spatie/laravel-settings (2.1.4)
  - Locking spatie/temporary-directory (1.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
2 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   ErrorException

  array_merge(): Expected parameter 2 to be an array, null given

  at E:\SoftwareElite\Projekte\Sector-V\UCPv2\vendor\spatie\laravel-settings\src\SettingsContainer.php:59
     55▕
     56▕         /** @var \Spatie\LaravelSettings\Settings[] $settings */
     57▕         $settings = array_merge(
     58▕             $this->discoverSettings(),
  ➜  59▕             config('settings.settings')
     60▕         );
     61▕
     62▕         return self::$settingsClasses = collect($settings)->unique();

  1   E:\SoftwareElite\Projekte\Sector-V\UCPv2\vendor\spatie\laravel-settings\src\SettingsContainer.php:59
      array_merge([])

  2   E:\SoftwareElite\Projekte\Sector-V\UCPv2\vendor\spatie\laravel-settings\src\SettingsContainer.php:27
      Spatie\LaravelSettings\SettingsContainer::getSettingClasses()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Also if i try to use php artisan i get this error now, i'm using Laravel 8 and PHP 7.4.14

I have now completly reinstalled Laravel and it works now, but on the new instalation i can't use laravel/passport and spatie/laravel-permissions together if i insall one of these two then composer uninstall the other page but it's okay.

This is somehow lately often with Spatie Packages, that there still missing configs are not taken into account. :(

  1. Remove the package:
composer remove spatie/laravel-settings
  1. Copy the config file (settings.php) to Your config folder

  2. Run config cache

php artisan config:cache
  1. Install the package
composer require spatie/laravel-settings