To get a public path in Laravel, you can use the public_path()
function.
Here’s an example:
$path = public_path('file.txt');
This will return the full path to the file.txt
file in the public
directory.
You can also use the asset()
function to generate a URL to a file in the public
directory.
Here’s an example:
$url = asset('img/logo.png');
This will return a URL to the logo.png
file in the public/img
directory.