Search code examples
phplaravellaravel-5laravel-artisanartisan-migrate

How to solve : Class 'AddSourceInClotureTable' not found in laravel 5.2


I'm using Laravel 5.2.45 on a PHP 5.6.16 server.

When using php artisan migrate:refresh / migrate:reset command, I get this error :

 [Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'AddSourceInClotureTable' not found

Note that migrate and migrate:rollback are working.

I tried googling (not a single result on : AddSourceInClotureTable), and tried with composer update, composer dumpauto, cache:clear and probably any single command artisan can do.

Here is the single migration file I have in the 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');
    }
}

And here is my composer.json

{
    "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"
    }
}

Any ideas ?


Solution

  • This project was duplicate from a previous one and the migrations table wasn't renamed. Human error here. As soon as a new name was given, all errors were gone.