spatie/laravel-settings

Remove migrations when schema loaded

chWagnr opened this issue · 1 comments

Hi,

I discovered an error after the sql dump was loaded. The regex does not work on anonymous settings migrations
in the migrations collection:

https://github.com/spatie/laravel-settings/blob/main/src/LaravelSettingsServiceProvider.php#L76

This results to return null in the mapWithKeys closure:

https://github.com/spatie/laravel-settings/blob/main/src/LaravelSettingsServiceProvider.php#L79

Which leads to an exception:

  foreach() argument must be of type array|object, null given

  at vendor/laravel/framework/src/Illuminate/Collections/Collection.php:821
    817▕ 
    818▕         foreach ($this->items as $key => $value) {
    819▕             $assoc = $callback($value, $key);
    820▕ 
  ➜ 821▕             foreach ($assoc as $mapKey => $mapValue) {
    822▕                 $result[$mapKey] = $mapValue;
    823▕             }
    824▕         }
    825▕ 

This is fixed with the newest version of the package.