The class is already in use and not the table.
The problem seems to be because you have a model class called CreateGalleriesPhotosTable and a migration class called CreateGalleriesPhotosTable.
Hi all,
I don't have duplicate table with the same, i tried to remove this table to see it passes but i got another error with other table too. also cleared cach but nothing changed. Any idea pls ?
Cannot declare class App\Models\CreateGalleriesPhotosTable, because the name is already in use
at database\migrations21_06_11_090235_create_galleries__photos_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateGalleriesPhotosTable extends Migration
8▕ {
9▕ /**
10▕ * Run the migrations.
11▕ *
Whoops\Exception\ErrorException
Cannot declare class App\Models\CreateGalleriesPhotosTable, because the name is already in use
at database\migrations21_06_11_090235_create_galleries__photos_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateGalleriesPhotosTable extends Migration
8▕ {
9▕ /**
10▕ * Run the migrations.
11▕ *
1 vendor\filp\whoops\src\Whoops\Run.php:510
Whoops\Run::handleError("Cannot declare class App\Models\CreateGalleriesPhotosTable, because the name is already in use", "D:\xampp\htdocs\db\code\oaahdv1\database\migrations21_06_11_090235_create_galleries__photos_table.php")
2 [internal]:0
Whoops\Run::handleShutdown()
in CreateGalleriesPhotosTable table
class CreateGalleriesPhotosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('galleries_photos', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Gallery::class)->constrained()->onDelete('cascade');
$table->string('photo')->nullable();
$table->boolean('status')->default(false);
$table->timestamps();
});
}
in galleries table
Copy
class CreateGalleriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('galleries', function (Blueprint $table) {
$table->id();
$table->text('title')->nullable();
$table->text('description')->nullable();
$table->timestamps();
});
}
Please or to participate in this conversation.