1

The dd($request) shows a pathInfo #pathInfo: "/nova-api/post-tags/20/update-fields". And I want to get that value, more specifically I want to check if "post-tags" is in the url.

However dd($request->pathInfo); shows:

null

But its not null as can be seen below:

Laravel\Nova\Http\Requests\NovaRequest {#1703
  #container: Illuminate\Foundation\Application {#2
    #basePath: "/var/www/src"
    #hasBeenBootstrapped: true
    #booted: true
    ....
      "request" => Illuminate\Http\Request {#43
        ...
        #routeResolver: Closure() {#655
          class: "Illuminate\Routing\Router"
          ...
          }
          file: "/var/www/src/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
          line: "650 to 652"
        }
        +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45
          #parameters: []
        }
        +request: Symfony\Component\HttpFoundation\ParameterBag {#51
          #parameters: array:5 [ …5]
        }
        +query: Symfony\Component\HttpFoundation\ParameterBag {#51}
        +server: Symfony\Component\HttpFoundation\ServerBag {#47
          #parameters: array:63 [ …63]
        }
        +files: Symfony\Component\HttpFoundation\FileBag {#48
          #parameters: []
        }
        +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46
          #parameters: array:4 [ …4]
        }
        +headers: Symfony\Component\HttpFoundation\HeaderBag {#49
          #headers: array:21 [ …21]
          #cacheControl: array:1 [ …1]
        }
        #content: ""
        #languages: null
        #charsets: null
        #encodings: null
        #acceptableContentTypes: null
        #pathInfo: "/nova-api/post-tags/20/update-fields"
        #requestUri: "/nova-api/post-tags/20/update-fields?editing=true&editMode=update&viaResource=&viaResourceId=&viaRelationship="
        #baseUrl: ""
        #basePath: null
        #method: "GET"
        #format: null
        ...
      }
      ....
}

Do you know what can be the issue?

2 Answers 2

3

According to the API docs, you should be able to do:

$request->path()

to get the path info for the request.

Sign up to request clarification or add additional context in comments.

Comments

3

$request->pathInfo is a protected property in symfony/http-foundation/Request.php. You need to access it $request->getPathInfo().

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.