2

I have to get the domain url (ex. http://www.example.com/) in laravel blade. I've tried using {{ url() }} but it returns the path to my public directory. Is there any one line function to get this? How do I get the domain in blade? Need help. Thanks.

3
  • you mean now it returns 'var/www/app/public' or 'www.app.com/public' ? Commented Jan 17, 2016 at 9:12
  • try {{ Request::root() }} Commented Jan 17, 2016 at 9:20
  • no i just need 'www.example.com' Commented Jan 17, 2016 at 10:31

1 Answer 1

8

You can also try

{{ Request::server ("SERVER_NAME") }} {{ Request::server ("SERVER_NAME") }}

Or go with {{ Request::root() }}

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

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.