Search code examples
phplaravellaravel-5laravel-5.4laravel-storage

Get the path of a dir I just created with Laravel Storage


Considering this code:

Storage::makeDirectory('my_dir');

Can I get the full path of my_dir right after? Something like:

echo Storage::getFullPathOf('my_dir');

Or do I need to do something with storage_path helper?


Solution

  • If you use >= 5.2, try to use url method (see Illuminate\Filesystem\FilesystemAdapter):

    Storage::url('my_dir'); // default disk
    

    or in custom disk:

    Storage::disk('amazon')->url('my_dir');