I do not know why this error jumps when I execute the migrations but I do not have repeated classes.
First Solution :
It seems like you have 2 migrations done at different time with essentially same name.
for example :
Laravel will convert this filename eliminating the date signature and Camel Casing the remaining text.
So both of these migration will have class
CreateRolesTable even if the time signatures are different. Check if your migrations directory have such 2 files.
To check this run this from terminal in project root :
grep -ri 'createrolestable' database/migrations
Second Solution :
Sometimes composer’s internal class autoloading causes this issue. Do following to check if it resolves :
Third Solution :
This is likely to be invalid but a same file should not have same class declaration 2 files by mistake.
Fourth Solution :
There might be a package you have installed which has a migration with same class name. To find run
grep -ril 'createrolestable' vendor
If it shows any file then thats what causing 2 classes to have same names.
You can create a new one
php artisan make:migration create_roles_table_custom . and then copy what you have in current migration to the new one and delete the existing one(not from package but the one you have created).
This will create a class
CreateRolesTableCustom which is different than what the package already has.
Answered By – Mihir Bhende