在Laravel中更改存储路径

时间:2014-02-07 16:12:11

标签: php laravel-4

是否可以更改为存储路径?我希望它在我们的生产环境中位于存储库之外,以使部署正常工作。

默认路径为app/storage/。我们正在使用4.1.x。

2 个答案:

答案 0 :(得分:2)

是的,确实如此。您可以在bootstrap/paths.php中定义它:

/*
|--------------------------------------------------------------------------
| Storage Path
|--------------------------------------------------------------------------
|
| The storage path is used by Laravel to store cached Blade views, logs
| and other pieces of information. You may modify the path here when
| you want to change the location of this directory for your apps.
|
*/

'storage' => __DIR__.'/../app/storage',

不要忘记为新目录设置所需的读/写权限。

答案 1 :(得分:1)

对于Laravel 5.0,您可以在bootstrap \ app.php

中执行此操作
$app->useStoragePath("/tmp/laravel_storage/");

希望这会对某人有所帮助......

编辑: 在Laravel 5.1中,这还不够......