Skip to content

Commit

Permalink
Merge pull request #9 from MedeirosDev/1.x
Browse files Browse the repository at this point in the history
Refactored equal to contains on Base Command
  • Loading branch information
abbasali authored Jan 20, 2022
2 parents 68fb9a5 + 375dba0 commit c86d608
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 c86d608

Please sign in to comment.