Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JDerby's avatar

php artisan migrate:refresh --seed "table 'slugs' not found"

Hi guys

Im having a strange problem.

I have a completely empty database, the DB connection is fine.

Running 'php artisan migrate:refresh --seed' is failing with it complaining about a missing table.

This would make sense if it was complaining about the migration table being missing but it's not it's moaning about one of my custom tables being missing 'slugs'.

php artisan cache:clear returns the same error..

I don't understand why the seed command cares about a 'missing table'? (The migration file is present).

What's also odd is that this table was one of the first migrations I made and the error didnt actually appear at any apparently sensible time (I wasn't even touching migrations)

Is there something else at play here I am missing?

Thanks

0 likes
1 reply
JDerby's avatar

Tracked the problem down to a repository I am instantiating via dependancy injection in a service provider..


    public function boot(CategoryRepositoryContract $categoryRepository)
    {

        $publicationCategories = $categoryRepository->getAll();

        View::share('publicationCategories', $publicationCategories);

    }

It seems the service provider is running during migrate and trying to access the database before the database exists.

No doubt this is inteded behaviour but it does seem a bit odd?

Please or to participate in this conversation.