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

Dobrý den,

vytvářím v PHP frameworku Laravel poprvé databázovou tabulku přes migrace a mám tam chybu. Dělám to takto:

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()
{
//
}
}



Dám migraci a je tam chyba:
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()






ODPOVĚĎ


Dobrý den,

chyba byla u mě, změnil jsem v laravel název třídy pro migraci z CreateItemsTable na CreateTableItems... Když jsem to vrátil, tak migrace doběhla... Show english version

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.