Skip to content

Commit a1769cf

Browse files
committed
Fix some blueprint inconsistencies
1 parent 84e78f7 commit a1769cf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Jenssegers/Mongodb/Schema/Blueprint.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,16 @@ public function dropIndex($columns = null)
114114
* Specify a unique index for the collection.
115115
*
116116
* @param string|array $columns
117+
* @param array $options
117118
* @return Blueprint
118119
*/
119-
public function unique($columns = null, $name = null)
120+
public function unique($columns = null, $options = [])
120121
{
121122
$columns = $this->fluent($columns);
122123

123-
$this->index($columns, ['unique' => true]);
124+
$options['unique'] = true;
125+
126+
$this->index($columns, $options);
124127

125128
return $this;
126129
}
@@ -144,12 +147,16 @@ public function background($columns = null)
144147
* Specify a sparse index for the collection.
145148
*
146149
* @param string|array $columns
150+
* @param array $options
147151
* @return Blueprint
148152
*/
149-
public function sparse($columns = null)
153+
public function sparse($columns = null, $options = [])
150154
{
151155
$columns = $this->fluent($columns);
152-
$this->index($columns, ['sparse' => true]);
156+
157+
$options['sparse'] = true;
158+
159+
$this->index($columns, $options);
153160

154161
return $this;
155162
}

0 commit comments

Comments
 (0)