PHP code example of underwear / laravel-vue-good-table
1. Go to this page and download the library: Download underwear/laravel-vue-good-table 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/ */
underwear / laravel-vue-good-table example snippets
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'),
];
}
}