1 | <?php |
||
15 | class UuidServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | public function boot() |
||
26 | |||
27 | protected function createGrammarFromConnection(Connection $connection): Grammar |
||
28 | { |
||
29 | $queryGrammar = $connection->getQueryGrammar(); |
||
30 | |||
31 | $queryGrammarClass = get_class($queryGrammar); |
||
32 | |||
33 | if (! in_array($queryGrammarClass, [ |
||
34 | IlluminateMySqlGrammar::class, |
||
35 | IlluminateSQLiteGrammar::class, |
||
36 | ])) { |
||
37 | throw new Exception("There current grammar `$queryGrammarClass` doesn't support binary uuids. Only MySql and SQLite connections are supported."); |
||
38 | } |
||
39 | |||
40 | if ($queryGrammar instanceof IlluminateSQLiteGrammar) { |
||
41 | $grammar = new SQLiteGrammar(); |
||
42 | } else { |
||
43 | $grammar = new MySqlGrammar(); |
||
44 | } |
||
45 | |||
46 | $grammar->setTablePrefix($queryGrammar->getTablePrefix()); |
||
47 | |||
48 | return $grammar; |
||
49 | } |
||
50 | |||
51 | protected function optimizeUuids() |
||
61 | } |
||
62 |