Skip to content

Commit

Permalink
Merge pull request #7 from rafaelmb/patch-1
Browse files Browse the repository at this point in the history
Sqlite compatibilty
ulearnpro authored Nov 6, 2019
2 parents a167d96 + f450317 commit 4482eab
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ static function getColumnTable($table)
{
$columns = array();
$prefix = \DB::getTablePrefix();
foreach (\DB::select("SHOW COLUMNS FROM $prefix$table") as $column) {
foreach (\DB::getSchemaBuilder()->getColumnListing($prefix.$table) as $column) {
//print_r($column);
$columns[$column->Field] = '';
$columns[$column] = '';
}

$object = (object) $columns;
6 changes: 6 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -24,5 +24,11 @@ public function register()
public function boot()
{
//
if (\DB::Connection() instanceof \Illuminate\Database\SQLiteConnection) {
\DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', function ($pattern, $value) {
mb_regex_encoding('UTF-8');
return (false !== mb_ereg($pattern, $value)) ? 1 : 0;
});
}
}
}

0 comments on commit 4482eab

Please sign in to comment.