I want to sort query in relation by type_order:
public function posts()
{
if (($this->type_order) == '1') {
$type = 'id';
return $this->belongsToMany(Post::class, 'feed_posts')->orderBy($type);
}
}
But get error:
FatalThrowableError
Call to a member function addEagerConstraints() on null