File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,6 @@ abstract class Controller extends \Illuminate\Routing\Controller
2626 */
2727 public static $ resource ;
2828
29- //@TODO: voir si toutes ces manières de call en static c'est pas plus dérangeant qu'autre chose
30- //@TODO: surtout avec octane où il faut éviter le static !?
3129 /**
3230 * Get a fresh instance of the resource represented by the entry.
3331 *
@@ -39,6 +37,4 @@ public static function newResource(): Resource
3937
4038 return new $ resource ;
4139 }
42-
43- //@TODO: are controllers useless in a certain way ??
4440}
Original file line number Diff line number Diff line change @@ -51,11 +51,10 @@ public function search(array $parameters = []) {
5151 $ this ->applyAggregates ($ parameters ['aggregates ' ]);
5252 });
5353
54- // @TODO: is this a problem also with HasMany ??
55- // @TODO: this will be the problem for every relation, need to fix this
56- // In case of BelongsToMany we cap the limit
57- $ limit = $ this ->queryBuilder instanceof \Illuminate \Database \Eloquent \Relations \BelongsToMany ? 9999 : ($ parameters ['limit ' ] ?? 50 );
58- $ this ->queryBuilder ->limit ($ limit );
54+ // In case we are in a relation we don't apply the limits since we dont know how much records will be related.
55+ if (!$ this ->queryBuilder instanceof Relation) {
56+ $ this ->queryBuilder ->limit ($ parameters ['limit ' ] ?? 50 );
57+ }
5958
6059 return $ this ->queryBuilder ;
6160 }
You can’t perform that action at this time.
0 commit comments