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

nafeeur10's avatar

PHP Fatal error: Cannot declare class CreatePermissionTables, because the name is already in use

I want to create new table with this:

php artisan make:migration create_contacts_table

But while I am running this command this error is coming.

PHP Fatal error:  Cannot declare class CreatePermissionTables, because the name is already in use

I am using Spatie Laravel Permission.

0 likes
4 replies
Sinnbeck's avatar

Are you sure? You wrote users in one place and permissions in another?

Also check database/migrations for a migration with the same name/class

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

And now you have contacts in one place and permissions in another?

Do you get this error no matter what you write as migration name?

1 like
Sinnbeck's avatar

If you do get the error no matter what you name the migration, you most likely already have 2 migrations with the same classname

1 like

Please or to participate in this conversation.