0

Thinking is that any way to call the routes from route files with their names and get the url to axios in vuejs.

I don't know is it possible or not. If not please suggest me some other way to get the routes which i declared in laravel routes php files. Thanks

2 Answers 2

1

One solution would be to do a Route::getRoutesByName which will return all your routes keyed by the name you provided. You could create a route that returns that route collection.

See the API here: https://laravel.com/api/5.7/Illuminate/Routing/RouteCollection.html#method_getRoutesByName

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

1 Comment

Thanks. let me try this
0
    <script>
  window.routes = {
    'users' : '{{ route('users') }}',
    'contact' : '{{ route('contact') }}',
  }

  // You can access it like this
  let route = window.routes.users
</script>

1 Comment

thanks for your answer. is their any way to get the routes without call all the routes separately and allocate it

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.