Laravel 5.1 database order by few columns

I want to sort result from database by few colums.
I trying like this:

Video::select('videoss.name as videoname', 'videos.*')->join('users', 'users.id', '=', 'videos.user_id')
        ->orderBy('videos.name', 'desc')
        ->orderBy('videos.views', 'desc')
        ->paginate(15);

but it is sorted only by name. How add sorting by views after sort by name.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s