BadMethodCallException:调用未定义的方法App \ Model \ Reply :: Like()

时间:2019-05-23 13:29:45

标签: php laravel laravel-5 laravel-5.8

当我尝试在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()

0 个答案:

没有答案