All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 2m5s
71 lines
1.9 KiB
PHP
71 lines
1.9 KiB
PHP
<?php namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Storage;
|
|
use League\Flysystem\Filesystem;
|
|
use League\Flysystem\Sftp\SftpAdapter;
|
|
use League\Flysystem\AwsS3v3\AwsS3Adapter as AwsS3v3Adapter;
|
|
use Aws\S3\S3Client;
|
|
|
|
class AppServiceProvider extends ServiceProvider {
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
// Force HTTPS URLs when behind a proxy (Traefik)
|
|
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
|
\URL::forceSchema('https');
|
|
}
|
|
|
|
//
|
|
\Blade::extend(function($value) {
|
|
return preg_replace('/\@define(.+)/', '<?php ${1}; ?>', $value);
|
|
});
|
|
|
|
Storage::extend('sftp', function ($app, $config) {
|
|
return new Filesystem(new SftpAdapter($config));
|
|
});
|
|
|
|
Storage::extend('minio', function ($app, $config) {
|
|
$client = new S3Client([
|
|
'credentials' => [
|
|
'key' => $config['key'],
|
|
'secret' => $config['secret'],
|
|
],
|
|
'region' => $config['region'],
|
|
'version' => 'latest',
|
|
'endpoint' => $config['endpoint'],
|
|
'use_path_style_endpoint' => filter_var($config['use_path_style_endpoint'] ?? true, FILTER_VALIDATE_BOOLEAN),
|
|
]);
|
|
$adapter = new AwsS3v3Adapter($client, $config['bucket']);
|
|
return new Filesystem($adapter);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* This service provider is a great spot to register your various container
|
|
* bindings with the application. As you can see, we are registering our
|
|
* "Registrar" implementation here. You can add your own bindings too!
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
// Laravel's HandleExceptions sets error_reporting(-1) which causes PECL mcrypt
|
|
// deprecation notices to become ErrorExceptions. Override it here to suppress E_DEPRECATED.
|
|
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
|
|
|
|
$this->app->bind(
|
|
'Illuminate\Contracts\Auth\Registrar',
|
|
'App\Services\Registrar'
|
|
);
|
|
}
|
|
|
|
}
|