/ Published in: PHP

In this article I would like to share how to make a sortable index view with Laravel 4.
Let’s assume you have an index view with a table. Like this example for a table that contains posts.
Let’s assume you have an index view with a table. Like this example for a table that contains posts.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function index() { $sortby = Input::get('sortby'); $order = Input::get('order'); if ($sortby && $order) { $posts = $this->post->orderBy($sortby, $order)->get(); } else { $posts = $this->post->get(); } }
URL: http://creative-punch.net/2014/01/sortable-index-view-laravel-4/
Comments
