1. Go to this page and download the library: Download nerweb/laravel-tblist library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nerweb / laravel-tblist example snippets
use Nerweb\Tblist\BaseTblist;
class UserTblist extends BaseTblist {
// set no result message
public $noResults = "No User found.";
function __construct()
{
$this->table = 'users';
$this->setQuery();
$this->setColumns();
}
protected function setQuery()
{
$this->query = User::where('active',1);
$this->columnsToSelect = array('*');
}
protected function setColumns()
{
$this->addCheckableColumn();
$this->columns['username'] = array(
'label' => 'Username',
'sortable' => true,
'table_column' => 'users.username',
);
$this->columns['email'] = array(
'label' => 'Email',
'sortable' => true,
'classes' => 'someclass someclass2',
'table_column' => 'users.email',
'thead_attr' => 'style="width:200px" data-someattr="example"',
);
$this->addActionColumn();
}
}
$list = new UserTblist();
$list->prepareList();
return View::make('users.index', array('list', $list));