@@ -164,7 +164,7 @@ public function index()
164
164
*
165
165
* @return mixed
166
166
*/
167
- public function show ()
167
+ public function show (... $ args )
168
168
{
169
169
// We need to do this in order to support multiple parameter resource routes. For example,
170
170
// if we map route /user/{user}/comments/{comment} to a controller, Laravel will pass `user`
@@ -216,7 +216,7 @@ public function store()
216
216
return ApiResponse::make ("Resource created successfully " , [ "id " => $ object ->id ], $ meta );
217
217
}
218
218
219
- public function update ()
219
+ public function update (... $ args )
220
220
{
221
221
\DB ::beginTransaction ();
222
222
@@ -254,7 +254,7 @@ public function update()
254
254
return ApiResponse::make ("Resource updated successfully " , [ "id " => $ object ->id ], $ meta );
255
255
}
256
256
257
- public function destroy ()
257
+ public function destroy (... $ args )
258
258
{
259
259
\DB ::beginTransaction ();
260
260
@@ -436,7 +436,13 @@ protected function addIncludes()
436
436
// need to be attached
437
437
if ($ q instanceof BelongsTo) {
438
438
$ fields [] = $ q ->getOtherKey ();
439
- // $relations[$key]["foreign"] = $q->getOtherKey();
439
+
440
+ if (strpos ($ key , ". " ) !== false ) {
441
+ $ parts = explode (". " , $ key );
442
+ array_pop ($ parts );
443
+
444
+ $ relation ["limit " ] = $ relations [implode (". " , $ parts )]["limit " ];
445
+ }
440
446
}
441
447
else if ($ q instanceof HasOne) {
442
448
$ fields [] = $ q ->getForeignKey ();
@@ -448,6 +454,8 @@ protected function addIncludes()
448
454
else if ($ q instanceof HasMany) {
449
455
$ fields [] = $ q ->getForeignKey ();
450
456
$ relations [$ key ]["foreign " ] = $ q ->getForeignKey ();
457
+
458
+ $ q ->orderBy ($ primaryKey , ($ relation ["order " ] == "chronological " ) ? "ASC " : "DESC " );
451
459
}
452
460
453
461
$ q ->select ($ fields );
@@ -694,7 +702,7 @@ protected function getMetaData($single = false)
694
702
\DB ::disableQueryLog ();
695
703
696
704
$ meta ["queries " ] = count ($ log );
697
- // $meta["queries_list"] = $log;
705
+ $ meta ["queries_list " ] = $ log ;
698
706
}
699
707
700
708
return $ meta ;
@@ -770,7 +778,7 @@ protected function isUpdate()
770
778
*/
771
779
protected function isDelete ()
772
780
{
773
- return in_array ("delete " , explode (". " , request ()->route ()->getName ()));
781
+ return in_array ("destroy " , explode (". " , request ()->route ()->getName ()));
774
782
}
775
783
776
784
/**
0 commit comments