eighty8 / laravel-seeder

Versioned, environment-based Seeders in Laravel
18 stars 16 forks source link

Laravel 5.6 #9

Closed diegohq closed 6 years ago

diegohq commented 6 years ago

I use this package in my apps, about a month ago I forked to be able to upgrade to Laravel 5.6. With it I was able to upgrade and didn't break for my usage.

I don't know if is necessary more changes but, at least, it is a starting point.

edmundluong88 commented 6 years ago

Hi @diegohq ,

Thank you for the pull request. Much appreciated!

The changes for the composer.json look great, but I noticed the addition of a new function in SeederRepository.php. Is this new with Laravel 5.6?

diegohq commented 6 years ago

Hello @edmundluong88 ,

Yes, SeederRepository implements SeederRepositoryInterface which implements Laravel's MigrationRepositoryInterface.

They addded in Laravel 5.6 this new function getMigrationBatches to MigrationRepositoryInterface. I don't know if we need to implement something in it but with the empty method I was able to proceed and run the seeders without problems.

edmundluong88 commented 6 years ago

Hi @diegohq ,

Thanks for the explanation. Although I would be fine with merging in this PR for Laravel 5.6 support, I did some digging and I was able to find the newly added getMigrationBatches call in 5.6 here:

    /**
     * Get the completed migrations with their batch numbers.
     *
     * @return array
     */
    public function getMigrationBatches()
    {
        return $this->table()
                ->orderBy('batch', 'asc')
                ->orderBy('migration', 'asc')
                ->pluck('batch', 'migration')->all();
    }

I believe this code can be directly copied into SeederRepository. If you can make this quick addition to the code I would be happy to merge this in!

Thanks!

diegohq commented 6 years ago

Hello @edmundluong88 ,

When I did this change I wasn't sure if I could just do that... I just updated the PR.

edmundluong88 commented 6 years ago

Hi @diegohq ,

Thank you for making that change. I have gone ahead and merged in the PR. Thank you very much for your contributions!