How to get base url in OctoberCMS?

I want to show the image in the backend render list. To do this, how to get the path to display the image. We tried the base_path () method.

But it gives me the full path, like "opt / lampp / htdocs / ashish /", but I want to get http: // localhost / ashish

+7
octobercms
source share
4 answers

Use Request :: getBaseUrl () to get the base path, e.g. http: // localhost / ashish

+4
source share

In the branch you can do:

{{ url('/') }} 
+9
source share

This is what I tried and showed perfectly that it works well when working with displaying images from a media manager.

 Config::get('cms.storage.media.path') 
0
source share

You can use:

 Config::get('app.url') 

but first you have to properly configure your base path in app / config.php

I think this is more general, and you can also force https if you need it.

0
source share

All Articles