soe-moe
soe-moe

Reputation: 41

How to create laravel custom storage:link?

How to create laravel custom storage:link?

I would like to point project/public/storage >> project/storage/app/tenancy/tenants

Upvotes: 3

Views: 4584

Answers (2)

user7153178
user7153178

Reputation:

In config/filesystems.php :

'links' => [
    public_path() . '_html\storage' => storage_path('app/public'),
],

after following this tutorial to change /public to /public_html

https://developerhowto.com/2018/11/12/how-to-change-the-laravel-public-folder/

Upvotes: 3

Mark Walet
Mark Walet

Reputation: 1186

At this moment it is not possible to customize the path with this command. I looked at the source code and couldn't find any hints regarding to this issue.

The simplest thing you can do is make the symbolic link yourself. The only thing this command does is create that symlink with PHP. This is the source code:

if (! windows_os()) {
    return symlink($target, $link);
}

$mode = $this->isDirectory($target) ? 'J' : 'H';

exec("mklink /{$mode} \"{$link}\" \"{$target}\"");

If you really need to make a command for it. You can create your own. If you want to see how Taylor did it, you can look in the following file:

vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php

Upvotes: 1

Related Questions