File: /var/www/vhost/disk-apps/agile-selling-wpb/app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use App\CorporateIdentity;
use App\Parameter;
use App\ServiceCity;
use App\UserInformation;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Blade;
// SFTP PCO
use Storage;
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
// Se envian las avariables de la identidad corporativa
view()->composer( 'cruz_verde', function( $view ){
$obj = CorporateIdentity::where('id', 1)->first();
$view->with('identity', $obj);
});
view()->composer( 'modules.head', function( $view ){
$obj = CorporateIdentity::where('id', 1)->first();
$view->with('identity', $obj);
});
view()->composer( 'modules.header', function( $view ){
$obj = CorporateIdentity::where('id', 1)->first();
$services = new ServiceCity();
$services->setConnection('main-db');
$servicesN = $services->where('active',1)->get();
// $db_name = UserInformation::where('user_id',Auth::user()->id)->first();
$view->with('identity', $obj)->with('services',$servicesN);
// ->with('db_name',$db_name->current_db);
// $view->with('identity', $obj);
});
view()->composer( 'auth.login', function( $view ){
$obj = CorporateIdentity::where('id', 1)->first();
$view->with('identity', $obj);
});
view()->composer( 'modules.aside', function( $view ){
$obj = Parameter::where('id', 1)->first();
$view->with('parameter', $obj);
});
view()->composer( 'layouts.app', function( $view ){
$obj = CorporateIdentity::where('id', 1)->first();
$view->with('identity', $obj);
});
Blade::directive('priceFormat', function ($price) {
return "<?php echo '$' . number_format($price, 2); ?>";
});
// SFTP PCO
Storage::extend('sftp', function ($app, $config) {
$config["root"] = "IF-016/in/";
return new Filesystem(new SftpAdapter($config));
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}