Skip to content

Instantly share code, notes, and snippets.

@andrey-helldar
Last active June 5, 2019 20:58
Show Gist options
  • Save andrey-helldar/6ba1ae5fb3cfc5ff15a39ab4c048944a to your computer and use it in GitHub Desktop.
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.
<?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