39 lines
847 B
PHP
39 lines
847 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use League\Flysystem\Filesystem;
|
|
use League\Flysystem\Sftp\SftpAdapter;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
// Force HTTPS when behind a proxy (Traefik)
|
|
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
|
\URL::forceSchema('https');
|
|
}
|
|
|
|
Storage::extend('sftp', function ($app, $config) {
|
|
return new Filesystem(new SftpAdapter($config));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
}
|