当前位置:Gxlcms > PHP教程 > laravel的YourCustomPivot怎么玩?

laravel的YourCustomPivot怎么玩?

时间:2021-07-01 10:21:17 帮助过:22人阅读

public function newPivot(Model $parent, array $attributes, $table, $exists)
{
    return new YourCustomPivot($parent, $attributes, $table, $exists);
}

class Base extends Eloquent {

public function newPivot(Eloquent $parent, array $attributes, $table, $exists)
{
     return new Membership($parent, $attributes, $table, $exists);
}

资料说这样玩,但是还是晕,各种报错

回复内容:

public function newPivot(Model $parent, array $attributes, $table, $exists)
{
    return new YourCustomPivot($parent, $attributes, $table, $exists);
}

class Base extends Eloquent {

public function newPivot(Eloquent $parent, array $attributes, $table, $exists)
{
     return new Membership($parent, $attributes, $table, $exists);
}

资料说这样玩,但是还是晕,各种报错

人气教程排行