Call to undefined relationship [videolikes] on model [App\Videopost].

Posted 1 month ago by MadMaks

Hi, i get this error message and don't know why, maybe you could help me out. Thanks in advance.

$productionPosts = Videopost::where('category' , 'Production')
            ->with('videolikes')
            ->get();

this is my user model

public function likesVideo()
    {
        return $this->belongsToMany(Videopost::class , 'videolikes')->withTimestamps();
    }

and this is my videopost model

public function hasVideoLikes()
    {
        return $this->belongsToMany(User::class , 'videolikes')->withTimestamps();
    }

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.