Skip to content

Commit 72cd1f1

Browse files
author
Pooya Parsa
committed
new Blueprint functions declaration (index, primary, unique)
1 parent b24f5d7 commit 72cd1f1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/Jenssegers/Mongodb/Schema/Blueprint.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ public function __construct(Connection $connection, $collection)
4444
*
4545
* @param string|array $columns
4646
* @param array $options
47+
* @param string $name
48+
* @param string|null $algorithm
4749
* @return Blueprint
4850
*/
49-
public function index($columns = null, $options = [])
51+
public function index($columns = null, $name = null, $algorithm = null, $options = [])
5052
{
5153
$columns = $this->fluent($columns);
5254

@@ -71,10 +73,12 @@ public function index($columns = null, $options = [])
7173
* Specify the primary key(s) for the table.
7274
*
7375
* @param string|array $columns
76+
* @param string $name
77+
* @param string|null $algorithm
7478
* @param array $options
7579
* @return \Illuminate\Support\Fluent
7680
*/
77-
public function primary($columns = null, $options = [])
81+
public function primary($columns = null, $name = null, $algorithm = null, $options = [])
7882
{
7983
return $this->unique($columns, $options);
8084
}
@@ -112,16 +116,18 @@ public function dropIndex($columns = null)
112116
* Specify a unique index for the collection.
113117
*
114118
* @param string|array $columns
119+
* @param string $name
120+
* @param string|null $algorithm
115121
* @param array $options
116122
* @return Blueprint
117123
*/
118-
public function unique($columns = null, $options = [])
124+
public function unique($columns = null, $name = null, $algorithm = null, $options = [])
119125
{
120126
$columns = $this->fluent($columns);
121127

122128
$options['unique'] = true;
123129

124-
$this->index($columns, $options);
130+
$this->index($columns, null, null, $options);
125131

126132
return $this;
127133
}
@@ -136,7 +142,7 @@ public function background($columns = null)
136142
{
137143
$columns = $this->fluent($columns);
138144

139-
$this->index($columns, ['background' => true]);
145+
$this->index($columns, null, null, ['background' => true]);
140146

141147
return $this;
142148
}
@@ -154,7 +160,7 @@ public function sparse($columns = null, $options = [])
154160

155161
$options['sparse'] = true;
156162

157-
$this->index($columns, $options);
163+
$this->index($columns, null, null, $options);
158164

159165
return $this;
160166
}
@@ -171,7 +177,7 @@ public function expire($columns, $seconds)
171177
{
172178
$columns = $this->fluent($columns);
173179

174-
$this->index($columns, ['expireAfterSeconds' => $seconds]);
180+
$this->index($columns, null, null, ['expireAfterSeconds' => $seconds]);
175181

176182
return $this;
177183
}

0 commit comments

Comments
 (0)