PHPackages                             arseto/laravel-table-view - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. arseto/laravel-table-view

ActiveLibrary[Search &amp; Filtering](/categories/search)

arseto/laravel-table-view
=========================

Laravel 5 Package for easily displaying table views for Eloquent Collections with search and sort functionality built in.

v0.1(8y ago)010MITCSSPHP &gt;=5.4.0

Since Apr 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/arseto/laravel-table-view)[ Packagist](https://packagist.org/packages/arseto/laravel-table-view)[ RSS](/packages/arseto-laravel-table-view/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

laravel-table-view
==================

[](#laravel-table-view)

Laravel 5 Package for easily displaying table views for Eloquent Collections with search and sort functionality built in.

This is a fork to attempt continuation of the original [project here](https://github.com/larkinwhitaker/laravel-table-view).

Installation
------------

[](#installation)

Update your `composer.json` file to include this package as a dependency

```
"arseto/laravel-table-view": "dev-master"
```

Register the TableView service provider by adding it to the providers array in the `config/app.php` file.

```
'providers' => array(
    Arseto\LaravelTableView\LaravelTableViewServiceProvider::class
)
```

If you want you can alias the TableView facade by adding it to the aliases array in the `config/app.php` file.

```
'aliases' => array(
        'TableView' => Arseto\LaravelTableView\Facades\TableView::class,
)
```

Configuration
=============

[](#configuration)

Copy the vendor file views and assets into your project by running

```
php artisan vendor:publish

```

This will add multiple styles and one script to public/vendor/table-view The plugin depends on jQuery and v1.9.1 will be included under public/vendor/table-view - Bootstrap CSS v3.3.2 - Font Awesome v4.3.0 - jQuery v1.9.1

Usage
=====

[](#usage)

Initialize the table view by passing in an instance of \\Illuminate\\Eloquent\\Builder or simply the class name of the model for the tableview

```
	$users = User::select('id', 'name', 'email', 'created_at');

	$usersTableView = TableView::collection( $users )
	// or $usersTableView = TableView::collection( \App\User::class )
```

Adding Columns to the tableview

```
	$usersTableView = $usersTableView
		// you can pass in the title for the column, and the Eloquent\Model property name
		->column('Email', 'email')

		// Add a colon after the Eloquent\Model property name along with sort and/or search to enable these options
		->column('Name', 'name:sort,search')

		// Set the default sorting property with
		->column('Name', 'name:sort*,search')	// Sorted Ascending by default or specify
		->column('Name', 'name:sort*:asc')
		->column('Name', 'name:sort*:desc')

		// Custom column values are created by passing an array with the Eloquent\Model property name as the key
		//  and a closure function
		->column('Joined At', ['created_at:sort*' => function ($user)
		{
			return $user->created_at->diffForHumans();
		}])

		// OR
		->column(function ($user)
		{
			return '';
		})
		->column('Email', 'email:sort,search')
		->column(function ($user)
		{
			return 'View';
		});
```

Custom column values

```
	$usersTableView = $usersTableView
		// You can pass in an array for the column's row value with the Eloquent\Model property name as the key
		//  and a closure function
		->column('Joined At', ['created_at:sort*' => function ($user)
		{
			return $user->created_at->diffForHumans();
		}])

		// OR if sorting and searching is unnecessary, simply pass in the Closure instead of the array
		->column('Image', function ($user)
		{
			return '';
		});
}]);
```

Columns without titles

```
	$usersTableView = $usersTableView
		// Just leave the column title out if you don't want to use it
		->column(function ($user)
		{
			return '';
		});
```

Additional Controls - you can add partial views containing custom controls like a filter button to add additional functionality to your table

```
	$usersTableView = $usersTableView
		// Just pass in the partial view file path of the custom control
		->headerControl('_types_filter_button');

		// access the TableView data collection with $usersTableView->data()
```

Finally, build the TableView and pass it to the view

```
	$usersTableView = $usersTableView->build();

	return view('test', [
		'usersTableView' => $usersTableView
	]);
```

All together with chaining

```
Route::get('/', function(\Illuminate\Http\Request $request)
{
	$users = User::select('id', 'name', 'email', 'created_at');

	$usersTableView = TableView::collection( $users, 'Administrator' )
		->column(function ($user)
		{
			return '';
		})
		->column('Name', 'name:sort,search')
		->column('Email', 'email:sort,search')
		->column('Joined At', ['created_at:sort*' => function ($user)
		{
			return $user->created_at->diffForHumans();
		}])
		->column(function ($user)
		{
			return 'View';
		})
		->headerControl('_types_filter_button')
		->build();

	return view('test', [
		'usersTableView' => $usersTableView
	]);
});
```

Front End
=========

[](#front-end)

Include stylesheets for Bootstrap and Font Awesome - Bootstrap CSS v3.3.2 and Font Awesome v4.3.0 are included in the vendor

```

```

Include the tablview in your view, referencing the variable name given to it

```
@include('table-view::container', ['tableView' => $usersTableView])
```

Also include the tablview scripts \*\* Requires jQuery and v1.9.1 will be included under public/vendor/table-view

```

@include('table-view::scripts')
```

Middleware Cookie Storage
=========================

[](#middleware-cookie-storage)

Selected options for the tableview are easily added to cookie storage with built-in Middleware.

Sort options and limits per page are each added to permanent storage. At any point, a user returning to the tableview will see these options filled with the same values that he/she selected in his/her most recent session.

The search query and page number are temporarily stored during the user's current session. With this, a user could visit something  with the tableview listing articles. When a user views a specific article like , any link back to  will show the tableview with its most recent page number and search query.

All you have to do:

Edit app/Http/Kernel.php, adding a reference to the Middleware

```
    /**
     * The application's route middleware.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,

        // Laravel TableView Middleware
        'table-view.storage' => \Arseto\LaravelTableView\Middleware\TableViewCookieStorage::class,
    ];
```

Then add it to the route containing the tableview

```
    Route::get('/', ['middleware' => 'table-view.storage', function () {
```

That's it!
==========

[](#thats-it)

It's particular but in just a few lines you have a dynamic table view with powerful functionality. Feel free to customize the tableview and element partial views. Additional themes and styles coming soon.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2950d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f1c1cc8329eb53ceee1ff1665a1020b45d06e0927adcc80af898dda0eaeffb8?d=identicon)[arseto](/maintainers/arseto)

---

Top Contributors

[![larkinwhitaker](https://avatars.githubusercontent.com/u/9460109?v=4)](https://github.com/larkinwhitaker "larkinwhitaker (20 commits)")[![arseto](https://avatars.githubusercontent.com/u/14993730?v=4)](https://github.com/arseto "arseto (3 commits)")

---

Tags

searchlaravelpaginationsortlaravel 5data tabletable-view

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arseto-laravel-table-view/health.svg)

```
[![Health](https://phpackages.com/badges/arseto-laravel-table-view/health.svg)](https://phpackages.com/packages/arseto-laravel-table-view)
```

###  Alternatives

[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[teamtnt/laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

1.1k2.5M28](/packages/teamtnt-laravel-scout-tntsearch-driver)[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[devnoiseconsulting/laravel-scout-postgres-tsvector

PostgreSQL Full Text Search Driver for Laravel Scout

58110.1k](/packages/devnoiseconsulting-laravel-scout-postgres-tsvector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
