1. Go to this page and download the library: Download bytestechnolabs/datagrid 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/ */
bytestechnolabs / datagrid example snippets
Datagrid\DatagridServiceProvider::class,
artisan storage:link
use Datagrid\Facades\DataGridFacade;
use Illuminate\Support\Facades\Session;
public function index()
{
// Define the unique session key
$sessionKey = config('datagrid.User_SessionKey');
// Retrieve the selected columns from the session
$columns = Session::get($sessionKey);
// Use default columns if session data is not set
if ($columns === null) {
$columns = config('datagrid.users_columns');
Session::put($sessionKey, $columns);
}
// Get all available columns
$columnsAll = config('datagrid.users_columns');
// Render the data grid
$dataGrid = DataGridFacade::model(User::class)
->columns($columns)
->searchColumns($columns)
->columnsAll($columnsAll)
->paginate(10);
return view('your blade file', ['dataGrid' => $dataGrid]);
}
// Define the unique session key
$sessionKey = config('datagrid.User_SessionKey');
// Retrieve the selected columns from the session
$columns = Session::get($sessionKey);
// Use default columns if session data is not set
if ($columns === null) {
$columns = config('datagrid.users_columns');
Session::put($sessionKey, $columns);
}
// Get all available columns
$columnsAll = config('datagrid.users_columns');
// Render the data grid
$dataGrid = DataGridFacade::model(User::class)
->columns($columns)
->searchColumns($columns)
->columnsAll($columnsAll)
->paginate(10);