SQL Field
CommunityA field to write SQL sentences using Codemirror 5.
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Author:
MrPowerUp82
Documentation
- Installation Filament v5.x
- Installation Filament v4.x
- Installation Filament v3.x
- Usage
- Configuration
- MIME types defined
- Links
- License

#Installation Filament v5.x
You can install the package via composer:
composer require mrpowerup/filament-sql-field
#Installation Filament v4.x
You can install the package via composer:
composer require mrpowerup/filament-sql-field "dev-filament-v4"
#Installation Filament v3.x
You can install the package via composer:
composer require mrpowerup/filament-sql-field "dev-filament-v3"
Or if you want to use 1.x version of the package you can use:
composer require mrpowerup/filament-sql-field "^1.0"
Or if you want to use 2.x version of the package you can use:
composer require mrpowerup/filament-sql-field "^2.0"
#Usage
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(),
])
]);
}
#Configuration
You can publish the configuration file using:
php artisan vendor:publish --tag="filament-sql-field-config"
This will create a config/filament-sql-field.php file where you can customize the available SQL dialects and add predefined templates.
#Dialects
You can define which SQL dialects are available in the editor's "Change Meme" dropdown:
'dialects' => [
'text/x-sql' => 'SQL',
'text/x-mysql' => 'MySQL',
// ...
],
#Templates
You can add predefined SQL templates that users can insert via the "Templates" dropdown:
'templates' => [
'User Select' => 'SELECT * FROM users;',
'Active Orders' => 'SELECT * FROM orders WHERE status = \'active\';',
],
#MIME types defined
- text/x-sql
- text/x-mysql
- text/x-mariadb
- text/x-cassandra
- text/x-plsql
- text/x-mssql
- text/x-hive
- text/x-pgsql
- text/x-gql
- text/x-gpsql
- text/x-esper
- text/x-sqlite
- text/x-sparksql
- text/x-trino
#If you need to update the editor value with dispatch here is an example:
$this->dispatch('updatePlugin', $record->sql);
@script
<script>
$wire.on('updatePlugin', (event) => {
window.editor.setValue(event[0]);
});
</script>
@endscript
#Links
#License
The MIT License (MIT). Please see License File for more information.
Featured Plugins
A selection of plugins curated by the Filament team
Blueprint
Filament Blueprint is a premium Laravel Boost extension that helps AI agents produce accurate, detailed implementation plans and security reports for Filament apps.
Filament
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese