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\FilamentSqlField;
public static function form(Form $form): Form
{
return $form
->schema([
FilamentSqlField::make('sql')
->mime('text/x-mysql') // Define MIME Type
->fullscreen() // Allow Fullscreen mode
// ->hintIcon('heroicon-m-question-mark-circle', tooltip: "F11: Fullscreen | Ctrl + Space: Autocomplete | ESC: Exit Fullscreen mode")
->connection('mysql') // Set connection
->autoGetTables() // Automatically get tables from database
->editorHeight(300) // Set height of editor
->dark() // Switch to Dark theme (Dracula Theme)
->default("SELECT * FROM users WHERE 1;") // Default SQL
->tables([
'table1' => [
'column1',
'column2',
'column3'
],
'table2' => [
'column1',
'column2',
'column3'
]
]) // Manually set tables
->columnSpanFull(),
]);
}
$this->dispatch('updatePlugin', 'SELECT * FROM table_name WHERE 1;');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.