Laravel 5.2 用 tinker 生成测试数据报错
求大神指教为什么会报错!
详细信息:
ModelFactory.php 中代码如下:
$factory->define(App\Models\Notice::class, function (Faker\Generator $faker) {
return [
'title' => $faker->sentences,
'content' => $faker->paragraph,
];
});
模型 Notice.php 之下了如下代码
我的model是在app\Models目录下的;我是用 php artisan make model:Models/Notice 生成的
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Notice extends Model
{
protected $table = 'notice';
protected $fillable = ['title','content'];
}
migration 如下:
Schema::create('notice', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('content');
$table->integer('user_id')->default('0');
$table->timestamps();
});
推荐文章: