File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 66
77class  Collection extends  BaseCollection
88{
9-     public  function  addToIndex ()
9+     /** 
10+      * @var array 
11+      */ 
12+     protected  $ addToIndexResult
13+ 
14+     /** 
15+      * @return bool 
16+      */ 
17+     public  function  addToIndex (): bool 
1018    {
1119        if  ($ this isEmpty ()) {
12-             return ;
20+             return   true ;
1321        }
1422
1523        $ instance$ this first ();
@@ -25,8 +33,18 @@ public function addToIndex()
2533
2634        $ success$ queryinsert ($ docsall ());
2735
36+         $ this addToIndexResult  = $ querygetQuery ()->getInsertResult ();
37+ 
2838        unset($ docs
2939
3040        return  $ success
3141    }
42+ 
43+     /** 
44+      * @return array|null 
45+      */ 
46+     public  function  getAddToIndexResult (): ?array 
47+     {
48+         return  $ this addToIndexResult ;
49+     }
3250}
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ class QueryBuilder extends BaseBuilder
3838
3939    protected  $ routing
4040
41+     protected  $ insertResult
42+ 
4143    /** 
4244     * All of the supported clause operators. 
4345     * 
@@ -731,9 +733,9 @@ public function cursor()
731733     */ 
732734    public  function  insert (array  $ valuesbool 
733735    {
734-         $ result $ this connection ->insert ($ this grammar ->compileInsert ($ this $ values
736+         $ this -> insertResult  = $ this connection ->insert ($ this grammar ->compileInsert ($ this $ values
735737
736-         return  empty ($ result 'errors ' ]);
738+         return  empty ($ this -> insertResult ['errors ' ]);
737739    }
738740
739741    /** 
@@ -767,6 +769,11 @@ public function delete($id = null): bool
767769        return  !empty ($ result'found ' ]);
768770    }
769771
772+     /** 
773+      * @param mixed $method 
774+      * @param mixed $parameters 
775+      * @return void 
776+      */ 
770777    public  function  __call ($ method$ parameters
771778    {
772779        if  (Str::startsWith ($ method'filterWhere ' )) {
@@ -776,6 +783,14 @@ public function __call($method, $parameters)
776783        return  parent ::__call ($ method$ parameters
777784    }
778785
786+     /** 
787+      * @return array 
788+      */ 
789+     public  function  getInsertResult (): array 
790+     {
791+         return  array_column ($ this insertResult ['items ' ], 'index ' );
792+     }
793+ 
779794    /** 
780795     * @return bool 
781796     */ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments