I found an other way to just get the base url to to display the value of environment variable APP_URL
env('APP_URL')
which will display the base url like http://domains_your//yours_website. beware it assumes that you had set the environment variable in .env file (that is present in the root folder).