ホームページ  >  記事  >  バックエンド開発  >  laravel的YourCustomPivot怎么玩?

laravel的YourCustomPivot怎么玩?

WBOY
WBOYオリジナル
2016-06-06 20:17:431300ブラウズ

<code>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);
}

</code>

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

回复内容:

<code>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);
}

</code>

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

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。