-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,53 @@ | ||
# laravel-vue-good-table | ||
Vue-good-table wrapper for Laravel. Server side tables without pain. | ||
|
||
## Reqs: | ||
1. Installed and globally registered [vue-good-table](https://xaksis.github.io/vue-good-table/) | ||
2. Installed and globally registered [vue-select](https://vue-select.org/), cause vue-good-table [issue #714](https://github.com/xaksis/vue-good-table/issues/714) | ||
|
||
## Usage | ||
|
||
Controller: | ||
```php | ||
class TestController extends Controller | ||
{ | ||
use InteractsWithVueGoodTable; | ||
|
||
protected function getQuery(Request $request) | ||
{ | ||
return Auction::query(); | ||
} | ||
|
||
protected function getColumns(): array | ||
{ | ||
return [ | ||
Text::make('ID', 'auction_id') | ||
->sortable() | ||
->searchable(), | ||
|
||
Text::make('Trip', 'trip_id') | ||
->displayUsing(function ($value) { | ||
return "<a href='/transport/trip/{$value}'>$value</a>"; | ||
}) | ||
->html(), | ||
|
||
Date::make('Start date', 'start_date') | ||
->sortable() | ||
->dateOutputFormat('dd.MM.yyyy HH:mm:ss'), | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
Routes: | ||
```php | ||
Route::get('/lvgt/config', 'TestController@handleConfigRequest'); | ||
Route::get('/lvgt/data', 'TestController@handleDataRequest'); | ||
``` | ||
|
||
Blade/HTML: | ||
```blade | ||
<div id="vue"> | ||
<laravel-vue-good-table data-url="/lvgt/data" config-url="/lvgt/config"/> | ||
</div> | ||
``` |