Tuesday, April 11, 2017

How to solve Method orderBy does not exist on laravel?

I use this package : https://github.com/andersao/l5-repository

My user repository is like this :

public function getList($year)
{
    $query = parent::findWhere(['year' => $year])
                 ->orderBy('updated_at')
                 ->paginate(10);
    return $query;
}

When executed, there exist error like this :

Method orderBy does not exist.

Whereas I see in the documentation, there exist orderBy

How can I solve it?



via samuel toh

Advertisement