/** * Format the request path info for routing. * * @param Illuminate\Http\Request $request * @return string */ protected function formatRequestPath($request) { $path = $request->getPathInfo(); if (strlen($path) > 1 and ends_with($path, '/')) { return '/' . ltrim(substr($path, 0, -1), '/'); } return '/' . ltrim($path, '/'); }