Issue
I do not know why this error jumps when I execute the migrations but I do not have repeated classes.
migrations:
class:
Solution
First Solution :
It seems like you have 2 migrations done at different time with essentially same name.
for example : 2019_01_18_020910_create_roles_table.php
and 2019_01_16_020910_create_roles_table.php
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 :
run composer install
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
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0