Download the PHP package tartan/laravel-table-view without Composer
On this page you can find all versions of the php package tartan/laravel-table-view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tartan/laravel-table-view
More information about tartan/laravel-table-view
Files in tartan/laravel-table-view
Package laravel-table-view
Short Description Laravel 5 Package for easily displaying table views for Eloquent Collections with search and sort functionality built in.
License MIT
Informations about the package laravel-table-view
laravel-table-view
Laravel 5 Package for easily displaying table views for Eloquent Collections with search and sort functionality built in.
Installation
Update your composer.json
file to include this package as a dependency
Register the TableView service provider by adding it to the providers array in the config/app.php
file.
If you want you can alias the TableView facade by adding it to the aliases array in the config/app.php
file.
Configuration
Copy the vendor file views and assets into your project by running
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
Initialize the table view by passing in an instance of \Illuminate\Eloquent\Builder or simply the class name of the model for the tableview
Adding Columns to the tableview
Custom column values
Columns without titles
Additional Controls - you can add partial views containing custom controls like a filter button to add additional functionality to your table
Finally, build the TableView and pass it to the view
All together with chaining
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
Also include the tablview scripts ** Requires jQuery and v1.9.1 will be included under public/vendor/table-view
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 http://tableview.com/blog-articles with the tableview listing articles. When a user views a specific article like http://tableview.com/blog-articles/laravel-blog/article, any link back to http://tableview.com/blog-articles 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
Then add it to the route containing the tableview
That's 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.