PHP code example of mrpowerup / filament-sql-field
1. Go to this page and download the library: Download mrpowerup/filament-sql-field 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/ */
mrpowerup / filament-sql-field example snippets
use MrPowerUp\FilamentSqlField\FilamentSqlSection;
use MrPowerUp\FilamentSqlField\FilamentSqlField;
public static function form(Form $form): Form
{
return $form
->schema([
FilamentSqlSection::make()
->schema([
FilamentSqlField::make('sql')
->fullscreen() // Allow Fullscreen mode
->editorHeight(300) // Set height of editor
->autoGetTables() // Automatically get tables from database
->default("SELECT * FROM users WHERE 1;")
->columnSpanFull(),
])
]);
}
$this->dispatch('updatePlugin', $record->sql);