我做所有的事情:
安装了新的 Laravel 5.3.9 应用程序(我所有的非新应用程序都会产生相同的错误)
跑
php artisan make:auth
为新表创建迁移 `php artisan make:migration create_quotations_table --create=quotations
Schema::create('quotations', function (Blueprint $table) { $table->increments('id'); $table->string('text'); // my problem persists even with the below two columns commented out $table->integer('creator_id')->unsigned()->index('creator_id'); $table->integer('updater_id')->unsigned()->index('updater_id'); $table->softDeletes(); $table->timestamps(); });
然后我跑
php artisan migrate
然后我定义一个新种子
php artisan make:seeder QuotationsTableSeeder
文件的完整内容,在我添加一个简单的插入之后:
<?php
use Illuminate\Database\Seeder;
class QuotationsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('quotations')->insert([
'text' => str_random(10),
]);
}
}
- 然后我跑
php artisan db:seed
问题
它根本行不通。没有反馈,日志文件中没有错误。该探针在我的本地环境(Win7,最新的 WAMP 服务器)和由 Ubuntu 16.04 支持的 Digital Ocean VPS 中持续存在。我在几个单独的应用程序中采取了上述所有步骤 - 没有结果。也在 Laragon 2.0.5 服务器下。
我试过的
php artisan optimize
正如这里建议的那样。
composer dump-autoload
我php artisan clear-compiled
也没有带来任何结果
我还尝试按照官方文档示例进行播种 - 失败了。
我添加use DB;
到种子文件中 - 仍然没有结果。
去做
帮助!!!他们怎么不工作?