@@ -7,14 +7,14 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
7
7
/**
8
8
* The MongoConnection object for this blueprint.
9
9
*
10
- * @var MongoConnection
10
+ * @var \Jenssegers\Mongodb\Connection
11
11
*/
12
12
protected $ connection ;
13
13
14
14
/**
15
15
* The MongoCollection object for this blueprint.
16
16
*
17
- * @var MongoCollection
17
+ * @var \Jenssegers\Mongodb\Collection|\MongoDB\Collection
18
18
*/
19
19
protected $ collection ;
20
20
@@ -32,7 +32,7 @@ public function __construct(Connection $connection, $collection)
32
32
{
33
33
$ this ->connection = $ connection ;
34
34
35
- $ this ->collection = $ connection ->getCollection ($ collection );
35
+ $ this ->collection = $ this -> connection ->getCollection ($ collection );
36
36
}
37
37
38
38
/**
@@ -54,6 +54,10 @@ public function index($columns = null, $name = null, $algorithm = null, $options
54
54
$ columns = $ transform ;
55
55
}
56
56
57
+ if ($ name !== null ) {
58
+ $ options ['name ' ] = $ name ;
59
+ }
60
+
57
61
$ this ->collection ->createIndex ($ columns , $ options );
58
62
59
63
return $ this ;
@@ -64,7 +68,7 @@ public function index($columns = null, $name = null, $algorithm = null, $options
64
68
*/
65
69
public function primary ($ columns = null , $ name = null , $ algorithm = null , $ options = [])
66
70
{
67
- return $ this ->unique ($ columns , $ options );
71
+ return $ this ->unique ($ columns , $ name , $ algorithm , $ options );
68
72
}
69
73
70
74
/**
@@ -102,7 +106,7 @@ public function unique($columns = null, $name = null, $algorithm = null, $option
102
106
103
107
$ options ['unique ' ] = true ;
104
108
105
- $ this ->index ($ columns , null , null , $ options );
109
+ $ this ->index ($ columns , $ name , $ algorithm , $ options );
106
110
107
111
return $ this ;
108
112
}
0 commit comments