Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public static function connection($name) |
||
24 | { |
||
25 | /** @var Connection $connection */ |
||
26 | $connection = static::$app['db']->connection($name); |
||
27 | |||
28 | if ($connection instanceof MySqlConnection) { |
||
29 | $mysql_grammar = $connection->withTablePrefix(new MySqlGrammar()); |
||
30 | |||
31 | $connection->setSchemaGrammar($mysql_grammar); |
||
32 | |||
33 | $schema_builder = $connection->getSchemaBuilder(); |
||
34 | |||
35 | // Use our own version of Blueprint. |
||
36 | // Note that the constructor signature changed between Laravel 5.6 and 5.7, |
||
37 | // so we use variable arguments to work with both. |
||
38 | $schema_builder->blueprintResolver(function (...$args) { |
||
39 | return new Blueprint(/** @scrutinizer ignore-type */ ...$args); |
||
|
|||
40 | }); |
||
41 | |||
42 | return $schema_builder; |
||
43 | } |
||
44 | |||
45 | return $connection->getSchemaBuilder(); |
||
46 | } |
||
58 |