close

[Solved] Error migrations: Cannot declare class X, because the name is already in use

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Error migrations: Cannot declare class X, because the name is already in use in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Error migrations: Cannot declare class X, because the name is already in use Error Occurs?

Today I get the following error Error migrations: Cannot declare class X, because the name is already in use in php.

How To Solve Error migrations: Cannot declare class X, because the name is already in use Error ?

  1. How To Solve Error migrations: Cannot declare class X, because the name is already in use Error ?

    To Solve Error migrations: Cannot declare class X, because the name is already in use Error I ran into this (misleading) error and it turned out I accidently omitted the word Create from the migration class name.

  2. Error migrations: Cannot declare class X, because the name is already in use

    To Solve Error migrations: Cannot declare class X, because the name is already in use Error I ran into this (misleading) error and it turned out I accidently omitted the word Create from the migration class name.

Solution 1


because table name is

Schema::create(‘tenants’

from

CreateLandlordTenantsTable

to

CreateTenantsTable 

Solution 2

I ran into this (misleading) error and it turned out I accidently omitted the word Create from the migration class name.

Error: Cannot declare class FooTable, because the name is already in use

Incorrect: class FooTable extends Migration

Correct: class CreateFooTable extends Migration

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment