Skip to content

Commit

Permalink
Refactored equal to conatins on Base Command
Browse files Browse the repository at this point in the history
  • Loading branch information
medeiroz committed Jan 15, 2022
1 parent 68fb9a5 commit 375dba0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Commands/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ protected function getSeederNamespace()
{
$composerJsonPath = base_path('composer.json');
$composerConfig = json_decode(file_get_contents($composerJsonPath), true);
$relativeSeederPath = str_replace($this->laravel->databasePath() . DIRECTORY_SEPARATOR, '', $this->getSeederFolder());
$seederConfigPath = config('seedonce.folder_seeder');

if ((float) app()->version() >= 8) {
$items = array_filter($composerConfig['autoload']['psr-4'], function ($item) use ($relativeSeederPath) {
return $item === $relativeSeederPath;
$items = array_filter($composerConfig['autoload']['psr-4'], function ($item) use ($seederConfigPath) {
return Str::contains($item, $seederConfigPath);
});

return array_keys($items)[0] ?? '';
Expand Down

0 comments on commit 375dba0

Please sign in to comment.