File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -273,26 +273,20 @@ public function all()
273273
274274 }
275275
276- public function get ()
276+ public function get ($ type = ' get ' )
277277 {
278278 if ($ this ->resource ->beforeQuery ($ this ) === false ){
279279 return ;
280280 }
281281 return $ this ->handleResponse ($ this ->sendRequest ('get ' , [
282282 $ this ->retreiveEndPoint ('get ' ),
283283 $ this ->addPagination ($ this ->combineQueries ())
284- ]), ' get ' );
284+ ]), $ type );
285285 }
286286
287287 public function getOne ()
288288 {
289- if ($ this ->resource ->beforeQuery ($ this ) === false ){
290- return ;
291- }
292- return $ this ->handleResponse ($ this ->sendRequest ('get ' , [
293- $ this ->retreiveEndPoint ('get ' ),
294- $ this ->addPagination ($ this ->combineQueries ())
295- ]), 'individual ' );
289+ return $ this ->get ('individual ' );
296290 }
297291
298292 public function post ($ attributes , $ type ="individual " )
Original file line number Diff line number Diff line change @@ -116,10 +116,12 @@ protected function populate($array)
116116 $ this ->incrementTotalDownloads (count ($ array [$ this ->resource ->getApiMultipleDataField ()]));
117117 return $ this ;
118118 } else {
119- foreach ($ array [$ this ->resource ->getApiMultipleDataField ()] as $ object ){
120- $ this ->items ->push ($ this ->resource ->newFromBuilder ($ this ->resource ->passOnAttributes ($ object )));
121- $ this ->incrementTotalDownloads ();
122- }
119+ if (isset ($ array [$ this ->resource ->getApiMultipleDataField ()])){
120+ foreach ($ array [$ this ->resource ->getApiMultipleDataField ()] as $ object ){
121+ $ this ->items ->push ($ this ->resource ->newFromBuilder ($ this ->resource ->passOnAttributes ($ object )));
122+ $ this ->incrementTotalDownloads ();
123+ }
124+ }
123125 }
124126 }
125127
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ protected function performUpdate(Builder $query)
387387 }
388388
389389 $ resource = (new $ this ->updateResource )->fill ($ this , 'update ' );
390-
390+
391391 if ($ resource ->getAttributes () != []){
392392
393393 $ validator = $ resource ->validate ();
@@ -613,6 +613,11 @@ public function fresh()
613613 return ;
614614 }
615615
616+ if (method_exists ($ this , 'find ' ))
617+ {
618+ return $ this ->find ($ this ->getKey ());
619+ }
620+
616621 return $ this ->newQuery ()->find ($ this ->getKey ());
617622 }
618623
You can’t perform that action at this time.
0 commit comments