*/ public function toArray(Request $request): array { $lang = $request->header('Accept-Language') ?? 'ru'; // Set the application locale to the retrieved language App::setLocale($lang); return [ 'id' => $this->id, 'status' => new StatusResource($this->getStatus), 'created_at' => $this->created_at->format('Y-m-d H:i:s'), 'total_amount' => $this->price_total, ]; } }