underwear / laravel-vue-good-table
Vue-good-table wrapper for Laravel. Server side tables without pain.
Installs: 16 693
Dependents: 0
Suggesters: 0
Security: 0
Stars: 41
Watchers: 1
Forks: 13
Open Issues: 3
Requires
- php: ^7.1|^8.0
- laravel/framework: ^5.6|^6.0|^7.0|^8.0|^9.0
This package is auto-updated.
Last update: 2024-12-27 17:39:42 UTC
README
Customizable table tool for Laravel, uses powerful vue-good-table. Server side tables without pain.
Supports pagination, filtering, searching, sorting. Inspired by Laravel Nova :)
Reqs
- Laravel 5.6+ or Laravel 6, Laravel 7, Laravel 8, Laravel 9
- Using Vue.js in your project
Usage example
- Use
InteractsWithVueGoodTable
trait in your controller and implement two methods:getColumns()
andgetQuery()
. - Register two new routes.
- Use Vue component
laravel-vue-good-table
wherever you want.
Controller:
namespace App\Http\Controllers; use LaravelVueGoodTable\InteractsWithVueGoodTable; use LaravelVueGoodTable\Columns\Column; use LaravelVueGoodTable\Columns\Date; use Illuminate\Http\Request; use App\User; class TestController extends Controller { use InteractsWithVueGoodTable; /** * Get the query builder * * @param Request $request * * @return Illuminate\Database\Eloquent\Builder */ protected function getQuery(Request $request) { return User::query(); } /** * Get the columns displayed in the table * * @return array */ protected function getColumns(): array { return [ Text::make('ID', 'id') ->sortable() ->searchable(), Text::make('Name', 'name') ->searchable(), Text::make('E-mail', 'email') ->searchable(), Date::make('Created At', 'created_at') ->sortable() ->dateOutputFormat('dd.MM.yyyy HH:mm:ss'), ]; } }
Routes:
Route::get('/lvgt/config', 'TestController@handleConfigRequest'); Route::get('/lvgt/data', 'TestController@handleDataRequest');
Blade/HTML:
<div id="vue"> <laravel-vue-good-table data-url="/lvgt/data" config-url="/lvgt/config"/> </div>
Installation
composer require underwear/laravel-vue-good-table
See the full Installation Guide in DOCUMENTATION.md
Documentation
See DOCUMENTATION.md
Contributing
Contributions are welcome!
Credits
License
The MIT License (MIT). Please see License File for more information.