samedi 26 décembre 2015

Laravel function to convert a realpath() to an absolute URL

I have declared a path pointing to a folder like this:

$path = realpath(public_path('uploads'));

This gives me that value: /var/www/mywebsite/public/uploads

Now, I want to turn this into an absolute URL, like this: http://ift.tt/1pLJEcq

Here is what I did:

dd(asset($path)); // Wrong: http://ift.tt/1SgYaqa
dd(url($path);    // Same.
dd('uploads');    // Right, but I only want to use $path

Is there a pre-built way to achieve this in Laravel 5?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire