Schema::connection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Reedware\LaravelBlueprints;
4
5
use Illuminate\Support\Facades\Schema as BaseFacade;
6
7
/**
8
 * @see \Illuminate\Database\Schema\Builder
9
 */
10
class Schema extends BaseFacade
11
{
12
    /**
13
     * Returns a new schema builder instance for the specified connection.
14
     *
15
     * @param  string  $name
16
     *
17
     * @return \Illuminate\Database\Schema\Builder
18
     */
19
    public static function connection($name)
20
    {
21
    	// Create the schema builder
22
        $schema = parent::connection($name);
23
24
        // Use the custom blueprint
25
        $schema->blueprintResolver(function($table, $callback) {
26
        	return new Blueprint($table, $callback);
27
        });
28
29
        // Return the schema
30
        return $schema;
31
    }
32
33
    /**
34
     * Returns a new schema builder instance for the default connection.
35
     *
36
     * @return \Illuminate\Database\Schema\Builder
37
     */
38
    protected static function getFacadeAccessor()
39
    {
40
    	// Create the schema builder
41
        $schema = parent::getFacadeAccessor();
42
43
        // Use the custom blueprint
44
        $schema->blueprintResolver(function($table, $callback) {
45
        	return new Blueprint($table, $callback);
46
        });
47
48
        // Return the schema
49
        return $schema;
50
    }
51
}
52