2017-11-06 21:17:17 -08:00
|
|
|
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This service provider handles sharing the snipeSettings variable, and sets
|
|
|
|
* some common upload path and image urls.
|
|
|
|
*
|
|
|
|
* PHP version 5.5.9
|
|
|
|
* @version v3.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
class SettingsServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Custom email array validation
|
|
|
|
*
|
|
|
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
|
|
* @since [v3.0]
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// Share common setting variables with all views.
|
|
|
|
view()->composer('*', function ($view) {
|
|
|
|
$view->with('snipeSettings', \App\Models\Setting::getSettings());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set some common variables so that they're globally available.
|
|
|
|
* The paths should always be public (versus private uploads)
|
|
|
|
*/
|
2018-09-29 21:33:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-06 21:17:17 -08:00
|
|
|
// Model paths and URLs
|
2018-09-29 21:33:52 -07:00
|
|
|
|
|
|
|
\App::singleton('assets_upload_path', function(){
|
|
|
|
return 'assets/';
|
|
|
|
});
|
|
|
|
|
2019-02-08 15:43:11 -08:00
|
|
|
\App::singleton('accessories_upload_path', function() {
|
|
|
|
return 'accessories/';
|
|
|
|
});
|
2018-09-29 21:33:52 -07:00
|
|
|
|
2017-11-06 21:17:17 -08:00
|
|
|
\App::singleton('models_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'assetmodels/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('models_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'assetmodels/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Categories
|
|
|
|
\App::singleton('categories_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'categories/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('categories_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'categories/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Locations
|
|
|
|
\App::singleton('locations_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'locations/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('locations_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'storage/public_uploads/locations/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Users
|
|
|
|
\App::singleton('users_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'users/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('users_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'public_uploads/users/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Manufacturers
|
|
|
|
\App::singleton('manufacturers_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'manufacturers/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('manufacturers_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'public_uploads/manufacturers/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Suppliers
|
|
|
|
\App::singleton('suppliers_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'suppliers/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('suppliers_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'storage/public_uploads/suppliers/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Departments
|
|
|
|
\App::singleton('departments_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'departments/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('departments_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'departments/';
|
2017-11-06 21:17:17 -08:00
|
|
|
});
|
|
|
|
|
2017-11-07 11:28:13 -08:00
|
|
|
// Company paths and URLs
|
|
|
|
\App::singleton('companies_upload_path', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'companies/';
|
2017-11-07 11:28:13 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
\App::singleton('companies_upload_url', function(){
|
2018-09-29 21:33:52 -07:00
|
|
|
return 'storage/public_uploads/companies/';
|
2017-11-07 11:28:13 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2017-11-06 21:17:17 -08:00
|
|
|
|
|
|
|
// Set the monetary locale to the configured locale to make helper::parseFloat work.
|
|
|
|
setlocale(LC_MONETARY, config('app.locale'));
|
|
|
|
setlocale(LC_NUMERIC, config('app.locale'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|