0

Is it possible, with laravel 4, to generate relatives url to use in forms and links ?

For example I have a form where I'd like to use a relative url to /user/login and laravel build the form with the full url http: //url.com/user/login

kitensei
  • 2,510
  • 2
  • 42
  • 68
  • 1
    take a look at [this](http://stackoverflow.com/a/26205470/3192276) answer – Razor Jan 30 '15 at 00:08
  • excellent, this is exactly what I was looking for, I have overridden the form macro so its render relatives urls :) can you make an answers so I can accept it ? – kitensei Jan 30 '15 at 08:42

1 Answers1

-1

I think what you need is helper functions.

Laravel helpers

secure_url

Generate a fully qualified URL to a given path using HTTPS.

echo secure_url('foo/bar', $parameters = array());

url

Generate a fully qualified URL to the given path.

echo url('foo/bar', $parameters = array(), $secure = null);
尤川豪
  • 459
  • 5
  • 26
  • this is kind of problematic as in development mode, my url are all in http as I don't want to install an SSL certificate for each app. So I would like the app to respond to either http or https depending on the proxy – kitensei Jan 29 '15 at 11:08
  • @kitensei With `url()` you shouldn't have that problem. It will detect the current scheme (http or https) and use that to generate the URL. `secure_url()` and the third parameter of `url()` are only there to *force* https. – lukasgeiter Jan 29 '15 at 18:37