Php 如何解决:类';AddSourceInClotureTable';未在laravel 5.2中找到
我正在PHP5.6.16服务器上使用Laravel5.2.45 使用php artisan migrate:refresh/migrate:reset命令时,出现以下错误:Php 如何解决:类';AddSourceInClotureTable';未在laravel 5.2中找到,php,laravel,laravel-5.2,laravel-artisan,artisan-migrate,Php,Laravel,Laravel 5.2,Laravel Artisan,Artisan Migrate,我正在PHP5.6.16服务器上使用Laravel5.2.45 使用php artisan migrate:refresh/migrate:reset命令时,出现以下错误: [Symfony\Component\Debug\Exception\FatalErrorException] Class 'AddSourceInClotureTable' not found 请注意,migrate和migrate:rollback正在工作 我尝试了谷歌搜索(在AddSourceInCloture
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'AddSourceInClotureTable' not found
请注意,migrate和migrate:rollback正在工作
我尝试了谷歌搜索(在AddSourceInClotureTable上没有一个结果),并尝试了composer update、composer dumpauto、cache:clear以及artisan可以执行的任何单个命令
以下是我在projet中的单个迁移文件:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommandTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('commands', function (Blueprint $table) {
$table->increments('id');
$table->integer("provider");
$table->string("number")->unique();;
$table->date("delivered_at");
$table->date("ordered_at");
$table->integer("buyer");
$table->boolean("deliver_mode");
$table->integer("payment");
$table->timestamps();
});
Schema::create('payment', function (Blueprint $table) {
$table->increments('id');
$table->string("name");
$table->timestamps();
});
Schema::create('transports', function (Blueprint $table) {
$table->increments('id');
$table->string("name", 255)->unique();
$table->string("code", 255)->unique();
$table->integer("carrier");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('commands');
Schema::drop('payment');
Schema::drop('transports');
}
}
有什么想法吗?每次执行
migrate
命令后,您应该始终运行composer dump autoload
或其别名composer dump autoload
命令:
如果在运行迁移时收到“未找到类”错误,请尝试运行composer dump autoload
命令并重新发出migrate命令
此项目与上一个项目重复,并且未重命名迁移表。这里有人为错误。新名字一出,所有错误都消失了。对不起,我试过了,但没什么新的,我已经编辑了我的问题。谢谢。您在哪里使用
AddSourceInClotureTable
?我觉得它应该是closure
而不是cloture
我完全不知道该类的用途。
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"barryvdh/laravel-ide-helper": "^2.1",
"laravelcollective/html": "5.2.*",
"barryvdh/laravel-dompdf": "0.6.*",
"caffeinated/flash": "~2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}