fix(backend): harden sanctum auth, remove dead models, add composite indexes and optimize homepage queries
Deploy Backend / deploy (push) Successful in 48s
Deploy Backend / deploy (push) Successful in 48s
This commit is contained in:
1 parent
5e6647d812
commit
accf0b6aab
8 files changed
+71
-75
No files matched your search
@@ -64,7 +64,14 @@ class AdminResourceController extends Controller
|
||||
return response()->json(['message' => 'Unknown admin resource.'], 404);
|
||||
}
|
||||
|
||||
$rows = $model::query()->with(self::RELATIONS[$resource] ?? [])->orderByDesc('id')->get();
|
||||
$query = $model::query()->with(self::RELATIONS[$resource] ?? [])->orderByDesc('id');
|
||||
|
||||
if ($request->has('per_page') && $request->integer('per_page') > 0) {
|
||||
return response()->json($query->paginate(min($request->integer('per_page'), 100)));
|
||||
}
|
||||
|
||||
$limit = min($request->integer('limit', 200), 500);
|
||||
$rows = $query->limit($limit)->get();
|
||||
|
||||
return response()->json(['data' => $rows]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user