Last active
June 5, 2019 20:58
-
-
Save andrey-helldar/6ba1ae5fb3cfc5ff15a39ab4c048944a to your computer and use it in GitHub Desktop.
Redefine the public and storage directories, as the site runs on a hosting on Laravel 5.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace APP\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ | |
$this->bindPublicPath(); | |
$this->bindStoragePath(); | |
} | |
/** | |
* Переопределяем публичную директорию, так как сайт запускается на хостинге. | |
*/ | |
private function bindPublicPath() | |
{ | |
$this->app->bind('path.public', function ($app) { | |
return \implode(DIRECTORY_SEPARATOR, [ | |
$app->basePath(), | |
'..', | |
'html', | |
]); | |
}); | |
} | |
/** | |
* Переопределяем директорию `storage`, так как сайт запускается на хостинге. | |
*/ | |
private function bindStoragePath() | |
{ | |
$this->app->bind('path.storage', function ($app) { | |
return \implode(DIRECTORY_SEPARATOR, [ | |
$app->basePath(), | |
'foo', | |
'bar', | |
]); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment