Skip to content

Commit

Permalink
use configured model for action
Browse files Browse the repository at this point in the history
  • Loading branch information
stevethomas committed Aug 30, 2022
1 parent a266f3a commit 932e3bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Actions/SyncFeaturesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Codinglabs\FeatureFlags\Actions;

use Codinglabs\FeatureFlags\Models\Feature;
use Illuminate\Database\Eloquent\Model;
use Codinglabs\FeatureFlags\Enums\FeatureState;

class SyncFeaturesAction
Expand All @@ -17,12 +17,12 @@ public function __invoke(): void
: $state
]);

$featureModels = Feature::all();
$featureModels = config('feature-flags.feature_model')::all();

$featureModels->whereNotIn('name', $features->pluck('name'))
->each(fn (Feature $feature) => $feature->delete());
->each(fn (Model $feature) => $feature->delete());

$features->whereNotIn('name', $featureModels->pluck('name'))
->each(fn (array $feature) => Feature::create($feature));
->each(fn (array $feature) => config('feature-flags.feature_model')::create($feature));
}
}

0 comments on commit 932e3bd

Please sign in to comment.