feat: implement Live Truck Radar caching
This commit is contained in:
@@ -20,9 +20,12 @@ class MyLiveTrucksController extends ApiController
|
||||
*/
|
||||
public function trucks(Request $request): JsonResponse
|
||||
{
|
||||
$household = Household::with('assignedDropOffPoint')
|
||||
->where('head_user_id', $request->user()->id)
|
||||
->first();
|
||||
$userId = $request->user()->id;
|
||||
$household = \Illuminate\Support\Facades\Cache::remember("user:{$userId}:household", now()->addMinutes(10), function () use ($userId) {
|
||||
return Household::with('assignedDropOffPoint')
|
||||
->where('head_user_id', $userId)
|
||||
->first();
|
||||
});
|
||||
|
||||
if (! $household || ! $household->assigned_drop_off_point_id) {
|
||||
return $this->ok([
|
||||
|
||||
Reference in New Issue
Block a user