Skip to content

Commit

Permalink
Fix test and PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Feb 19, 2024
1 parent c60f347 commit 1a42fda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ parameters:
count: 1
path: src/Models/SettingsProperty.php

-
message: "#^Property 'payload' does not exist in Spatie\\\\LaravelSettings\\\\Models\\\\SettingsProperty model\\.$#"
count: 1
path: src/Models/SettingsProperty.php

-
message: "#^Call to method toArray\\(\\) on an unknown class Spatie\\\\DataTransferObject\\\\DataTransferObject\\.$#"
count: 1
Expand Down
8 changes: 7 additions & 1 deletion src/LaravelSettingsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Spatie\LaravelSettings;

use Illuminate\Database\Events\SchemaLoaded;
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use Spatie\LaravelSettings\Console\CacheDiscoveredSettingsCommand;
Expand Down Expand Up @@ -99,8 +101,12 @@ private function removeMigrationsWhenSchemaLoaded(SchemaLoaded $event)
->filter()
->values();

$migrationsConfig = config()->get('database.migrations');

$migrationsTable = is_array($migrationsConfig) ? ($migrationsConfig['table'] ?? null) : $migrationsConfig;

$event->connection
->table(config()->get('database.migrations'))
->table($migrationsTable)
->useWritePdo()
->whereIn('migration', $migrations)
->delete();
Expand Down

0 comments on commit 1a42fda

Please sign in to comment.