PHP Laravel - php artisan migrate - Class Table not found -  Illuminate\Foundation\Console\Kernel

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:

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 ...

Související obsah

programovani

php

laravel

databaze

sql

Komentáře

Vaše reakce na PHP Laravel - php artisan migrate - Class Table not found - Illuminate\Foundation\Console\Kernel

Reference

Podívejte se na naše reference

Prohlédnout

Aplikace

Podívejte se na naše aplikace

Prohlédnout

Co umíme?

Podívejte se co umíme

Prohlédnout

Co umíme?

Vytváříme sofistikované aplikace pro náročné

Od webových aplikací přes android až po převodové můstky či složité informační systémy.

Podívejte se k nám

Máte ještě čas? Podívejte se na další rubriky

Tento web používá soubory cookie. Dalším procházením tohoto webu vyjadřujete souhlas s jejich používáním.. Více informací zde.