This repository was archived by the owner on Nov 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function update(Collection $models)
43
43
}
44
44
45
45
$ actionPayload = (new RawPayload ())
46
- ->set ('index._id ' , $ model ->getKey ());
46
+ ->set ('index._id ' , $ model ->getScoutKey ());
47
47
48
48
$ bulkPayload
49
49
->add ('body ' , $ actionPayload ->get ())
@@ -64,7 +64,7 @@ public function delete(Collection $models)
64
64
65
65
$ models ->each (function ($ model ) use ($ bulkPayload ) {
66
66
$ actionPayload = (new RawPayload ())
67
- ->set ('delete._id ' , $ model ->getKey ());
67
+ ->set ('delete._id ' , $ model ->getScoutKey ());
68
68
69
69
$ bulkPayload ->add ('body ' , $ actionPayload ->get ());
70
70
});
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class DocumentPayload extends TypePayload
16
16
*/
17
17
public function __construct (Model $ model )
18
18
{
19
- if ($ model ->getKey () === null ) {
19
+ if ($ model ->getScoutKey () === null ) {
20
20
throw new Exception (sprintf (
21
21
'The key value must be set to construct a payload for the %s instance. ' ,
22
22
get_class ($ model )
@@ -25,7 +25,7 @@ public function __construct(Model $model)
25
25
26
26
parent ::__construct ($ model );
27
27
28
- $ this ->payload ['id ' ] = $ model ->getKey ();
28
+ $ this ->payload ['id ' ] = $ model ->getScoutKey ();
29
29
$ this ->protectedKeys [] = 'id ' ;
30
30
}
31
31
}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public function mockModel(array $params = [])
19
19
$ params ['methods ' ] ?? [],
20
20
[
21
21
'getKey ' ,
22
+ 'getScoutKey ' ,
22
23
'trashed ' ,
23
24
'searchableAs ' ,
24
25
'toSearchableArray ' ,
@@ -35,6 +36,10 @@ public function mockModel(array $params = [])
35
36
->method ('getKey ' )
36
37
->willReturn ($ params ['key ' ] ?? 1 );
37
38
39
+ $ mock
40
+ ->method ('getScoutKey ' )
41
+ ->willReturn ($ params ['key ' ] ?? 1 );
42
+
38
43
$ mock
39
44
->method ('trashed ' )
40
45
->willReturn ($ params ['trashed ' ] ?? false );
You can’t perform that action at this time.
0 commit comments