To install the Data Grid component, you need to install both the core component and the bridge:
Warning:
Spiral does not provide Cycle ORM out of the box. To use this component, you need to installspiral/cycle-bridge
component. You can find more information about Cycle ORM Bridge in the The Basics — Database and ORMsection.
Activate the bootloader Spiral\DataGrid\Bootloader\GridBootloader
in your application after Cycle bootloaders:
public function defineBootloaders(): array
{
return [
// ...
\Spiral\DataGrid\Bootloader\GridBootloader::class,
// ...
];
}
Read more about bootloaders in the Framework — Bootloaders section.
After installation, set up the writers for your data sources in the app/config/dataGrid.php
config file.
Here's a basic setup for Cycle ORM Bridge:
return [
'writers' => [
\Spiral\Cycle\DataGrid\Writer\QueryWriter::class,
\Spiral\Cycle\DataGrid\Writer\PostgresQueryWriter::class,
\Spiral\Cycle\DataGrid\Writer\BetweenWriter::class,
],
];
Note
As you can see, we can register multiple writers for different specifications. The order of writers is important, as the compiler will use them in the same order as they are registered.