Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

->withPivot() makes assertBelongsToMany() fail #30

Open
martindilling opened this issue Aug 7, 2013 · 2 comments
Open

->withPivot() makes assertBelongsToMany() fail #30

martindilling opened this issue Aug 7, 2013 · 2 comments

Comments

@martindilling
Copy link

I'm trying to write a test for this

public function challengeoptions()
{
    return $this->belongsToMany('Challengeoptions')
                ->withPivot('donepct')
                ->withTimestamps();
}

But when trying to use assertBelongsToMany() I'm just getting the error:

PHP Fatal error:  Call to a member function withPivot() on a non-object in....

Anyone know a way to fix it, or to test it another way? :)

@Fuhrmann
Copy link

Fuhrmann commented Sep 4, 2013

I get the same error because my relationships are something like this:

public function midias()
{
    return $this->hasMany('Midia', 'id_conteudo')
        ->where('model', '=', 'Blog')
        ->orderBy('ordem', 'ASC');
}

@SammyK
Copy link

SammyK commented Jan 8, 2014

Just added pull request #52 that fixes this. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants