Php 调用未定义的方法Illumb\Database\Query\Builder::Passentials()

Php 调用未定义的方法Illumb\Database\Query\Builder::Passentials(),php,laravel,eloquent,query-builder,Php,Laravel,Eloquent,Query Builder,我想为显示此错误的数据库设置种子: 调用未定义的方法Illumb\Database\Query\Builder::Passentials() 这是数据库播种机: public function run() { // $this->call(UsersTableSeeder::class); factory(App\Airport::class, 5)->create(); factory(App\Flight::class, 10)->create()-

我想为显示此错误的数据库设置种子:

调用未定义的方法Illumb\Database\Query\Builder::Passentials()

这是数据库播种机:

public function run()
{
    // $this->call(UsersTableSeeder::class);
    factory(App\Airport::class, 5)->create();
    factory(App\Flight::class, 10)->create()->each(function ($flight) {
        factory(App\Customer::class, 100)->make()->each(function ($customer) use ($flight) {
            $flight->passengers()->save($customer);
        });
    });
}
客户模式: 飞行模型
谁知道这会发生在哪里?

您在模型中使用了单数,并试图在播种机中使用复数

class Flight extends Model
{
    public function passengers()
    {
        return $this->belongsto('App\Customer', 'flight_customer');
    }
}

请出示您的
航班
机型的代码好吗?@RossWilson当然可以。我编辑过,所以我该怎么办。你能帮我一下吗?就在那儿。您可以将乘客模型的方法重命名为
乘客
,或者将播种机中使用的方法重命名为
乘客
class Flight extends Model
{
    //
    public function arrivalAirport(){
        return $this->belongsto('App\Airport','arrivalAirport_id');
    }
    public function departureAirport(){
        return $this->belongsto('App\Airport','departureAirport');
    }
    public function passenger(){
        return $this->belongsto('App\Customer','flight_customer');
    }
}
class Flight extends Model
{
    public function passengers()
    {
        return $this->belongsto('App\Customer', 'flight_customer');
    }
}