当我尝试在laravel中使用种子命令时,出现此错误:
BadMethodCallException:调用未定义的方法App \ Model \ Reply :: Like()
我已经尝试了一切:
<?php
/* @var $factory \Illuminate\Database\Eloquent\Factory */
use App\Model\Question;
use Faker\Generator as Faker;
use App\Model\Category;
use App\User;
$factory->define(Question::class, function (Faker $faker) {
$title = $faker->sentence();
return [
'title' => $title,
'slug' => str_slug($title),
'body' => $faker->text,
'category_id' => function() {
return Category::all()->random();
},
'user_id'=> function() {
return User::all()->random();
}
];
});
BadMethodCallException:调用未定义的方法App \ Model \ Reply :: Like()