PHP Laravel - php artisan migrate - Class Table not found - Illuminate\Foundation\Console\Kernel
Hi,
I am creating a database table for the first time in the PHP framework Laravel via migration and I have an error there. I do it like this:
I'll give the migration and there's a mistake:
Hi,
the error was with me, I changed the name of the migration class from CreateItemsTable to CreateTableItems in laravel ... When I returned it, the migration ran ...
I am creating a database table for the first time in the PHP framework Laravel via migration and I have an error there. I do it like this:
cd /var/www/laravel
php artisan make:migration create_items_table
vim database/migrations/2020_06_22_112336_create_items_table.php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableItems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('items', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->decimal('price');
$table->text('desc');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
I'll give the migration and there's a mistake:
php artisan migrate
Error
Class 'CreateItemsTable' not found
at vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:453
449| public function resolve($file)
450| {
451| $class = Str::studly(implode('_', array_slice(explode('_', $file), 4)));
452|
> 453| return new $class;
454| }
455|
456| /**
457| * Get all of the migration files in a given path.
+20 vendor frames
21 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
REPLY
Hi,
the error was with me, I changed the name of the migration class from CreateItemsTable to CreateTableItems in laravel ... When I returned it, the migration ran ...