【问题标题】:Can not run php artisan migrate command无法运行 php artisan migrate 命令
【发布时间】:2016-09-07 13:03:50
【问题描述】:

我正确安装了所有东西,但现在我需要运行:

php artisan migrate

但是当我运行该命令时,我得到: enter image description here

这里有什么问题?

我的 laravel.log 文件说:

#8 /var/www/html/laravel3/vendor/symfony/console/Application.php(841): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/laravel3/vendor/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/laravel3/vendor/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/laravel3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/laravel3/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

更新:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('admin');
            $table->string('name');
            $table->string('phone');
            $table->string('hotel');
            $table->string('address');
            $table->string('url');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }
}

这是我的用户迁移文件

【问题讨论】:

    标签: laravel migration laravel-5.1 laravel-artisan


    【解决方案1】:

    这很可能是语法错误。可能在创建用户表迁移。检查该文件是否有语法错误。

    【讨论】:

    • 您可以发布迁移文件的内容吗?
    • 你能运行吗:find /var/www/html/laravel3/ -type f -name '*.php' -exec php -l {} \;看看另一个文件中是否有任何语法错误? 抱歉,这不适用于 Windows
    • 我的建议是找到一种方法来“lint”所有 php 文件以查找任何语法错误
    猜你喜欢
    • 1970-01-01
    • 2017-05-31
    • 2018-12-05
    • 1970-01-01
    • 2017-08-08
    • 2020-06-20
    • 2019-02-24
    • 2017-11-02
    • 2017-09-27
    相关资源
    最近更新 更多