# Bug Fix: InstallCommand.php — Settings Migrations Skipped

## File Changed
`plugins/webkul/support/src/Console/Commands/InstallCommand.php`

## The Bug (Line 279)

In the `runMigrations()` method, the settings migration loop incorrectly used the
variable `$migration` (from the previous regular migrations loop) instead of `$setting`
(the current loop variable). This caused every settings migration to be skipped during
plugin installation.

### Before
```php
foreach ($this->package->settingFileNames as $setting) {
    if ($this->hasMigrationAlreadyRun($migration)) { // wrong variable
        continue;
    }
```

### After
```php
foreach ($this->package->settingFileNames as $setting) {
    if ($this->hasMigrationAlreadyRun($setting)) { // correct variable
        continue;
    }
```

## Impact

Any plugin that declares settings via `hasSettings()` in its ServiceProvider would have
its settings migrations silently skipped when running `php artisan {plugin}:install`.
This resulted in errors like:

```
Spatie\LaravelSettings\Exceptions\MissingSettings
Tried loading settings 'Webkul\Inventory\Settings\WarehouseSettings',
and the following properties were missing: enable_locations, enable_multi_steps_routes
```

Affected plugins include: inventories, projects, products, purchases, sales, and any
other plugin that uses settings migrations.

## Affected Plugins (already installed before fix)

If any of these plugins were installed before this fix, their settings migrations must
be run manually:

```bash
php artisan migrate --path="plugins/webkul/inventories/database/settings"
php artisan migrate --path="plugins/webkul/projects/database/settings"
php artisan migrate --path="plugins/webkul/products/database/settings"
php artisan migrate --path="plugins/webkul/purchases/database/settings"
php artisan migrate --path="plugins/webkul/sales/database/settings"
```

Going forward, `php artisan {plugin}:install` will correctly run both table and
settings migrations in a single command.
