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)
4343 }
4444
4545 $ actionPayload = (new RawPayload ())
46- ->set ('index._id ' , $ model ->getKey ());
46+ ->set ('index._id ' , $ model ->getScoutKey ());
4747
4848 $ bulkPayload
4949 ->add ('body ' , $ actionPayload ->get ())
@@ -64,7 +64,7 @@ public function delete(Collection $models)
6464
6565 $ models ->each (function ($ model ) use ($ bulkPayload ) {
6666 $ actionPayload = (new RawPayload ())
67- ->set ('delete._id ' , $ model ->getKey ());
67+ ->set ('delete._id ' , $ model ->getScoutKey ());
6868
6969 $ bulkPayload ->add ('body ' , $ actionPayload ->get ());
7070 });
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class DocumentPayload extends TypePayload
1616 */
1717 public function __construct (Model $ model )
1818 {
19- if ($ model ->getKey () === null ) {
19+ if ($ model ->getScoutKey () === null ) {
2020 throw new Exception (sprintf (
2121 'The key value must be set to construct a payload for the %s instance. ' ,
2222 get_class ($ model )
@@ -25,7 +25,7 @@ public function __construct(Model $model)
2525
2626 parent ::__construct ($ model );
2727
28- $ this ->payload ['id ' ] = $ model ->getKey ();
28+ $ this ->payload ['id ' ] = $ model ->getScoutKey ();
2929 $ this ->protectedKeys [] = 'id ' ;
3030 }
3131}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public function mockModel(array $params = [])
1919 $ params ['methods ' ] ?? [],
2020 [
2121 'getKey ' ,
22+ 'getScoutKey ' ,
2223 'trashed ' ,
2324 'searchableAs ' ,
2425 'toSearchableArray ' ,
@@ -35,6 +36,10 @@ public function mockModel(array $params = [])
3536 ->method ('getKey ' )
3637 ->willReturn ($ params ['key ' ] ?? 1 );
3738
39+ $ mock
40+ ->method ('getScoutKey ' )
41+ ->willReturn ($ params ['key ' ] ?? 1 );
42+
3843 $ mock
3944 ->method ('trashed ' )
4045 ->willReturn ($ params ['trashed ' ] ?? false );
You can’t perform that action at this time.
0 commit comments