Skip to content

Commit

Permalink
Add Regexp to sqlite
Browse files Browse the repository at this point in the history
this code allows sqlite to use regexp just like mysql
  • Loading branch information
rafaelmb authored Nov 6, 2019
1 parent ed057fd commit f450317
Showing 1 changed file with 6 additions and 0 deletions.
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 f450317

Please sign in to comment.