mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
934afa036f
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
159 lines
4.1 KiB
PHP
159 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Setting;
|
|
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', Setting::getSettings());
|
|
});
|
|
|
|
/**
|
|
* Set some common variables so that they're globally available.
|
|
* The paths should always be public (versus private uploads)
|
|
*/
|
|
|
|
// Model paths and URLs
|
|
|
|
\App::singleton('assets_upload_path', function () {
|
|
return 'assets/';
|
|
});
|
|
|
|
\App::singleton('accessories_upload_path', function () {
|
|
return 'public/uploads/accessories/';
|
|
});
|
|
|
|
\App::singleton('models_upload_path', function () {
|
|
return 'models/';
|
|
});
|
|
|
|
\App::singleton('models_upload_url', function () {
|
|
return 'models/';
|
|
});
|
|
|
|
// Categories
|
|
\App::singleton('categories_upload_path', function () {
|
|
return 'categories/';
|
|
});
|
|
|
|
\App::singleton('categories_upload_url', function () {
|
|
return 'categories/';
|
|
});
|
|
|
|
// Locations
|
|
\App::singleton('locations_upload_path', function () {
|
|
return 'locations/';
|
|
});
|
|
|
|
\App::singleton('locations_upload_url', function () {
|
|
return 'locations/';
|
|
});
|
|
|
|
// Users
|
|
\App::singleton('users_upload_path', function () {
|
|
return 'avatars/';
|
|
});
|
|
|
|
\App::singleton('users_upload_url', function () {
|
|
return 'users/';
|
|
});
|
|
|
|
// Manufacturers
|
|
\App::singleton('manufacturers_upload_path', function () {
|
|
return 'manufacturers/';
|
|
});
|
|
|
|
\App::singleton('manufacturers_upload_url', function () {
|
|
return 'manufacturers/';
|
|
});
|
|
|
|
// Suppliers
|
|
\App::singleton('suppliers_upload_path', function () {
|
|
return 'suppliers/';
|
|
});
|
|
|
|
\App::singleton('suppliers_upload_url', function () {
|
|
return 'suppliers/';
|
|
});
|
|
|
|
// Departments
|
|
\App::singleton('departments_upload_path', function () {
|
|
return 'departments/';
|
|
});
|
|
|
|
\App::singleton('departments_upload_url', function () {
|
|
return 'departments/';
|
|
});
|
|
|
|
// Company paths and URLs
|
|
\App::singleton('companies_upload_path', function () {
|
|
return 'companies/';
|
|
});
|
|
|
|
\App::singleton('companies_upload_url', function () {
|
|
return 'companies/';
|
|
});
|
|
|
|
// Accessories paths and URLs
|
|
\App::singleton('accessories_upload_path', function () {
|
|
return 'accessories/';
|
|
});
|
|
|
|
\App::singleton('accessories_upload_url', function () {
|
|
return 'accessories/';
|
|
});
|
|
|
|
// Consumables paths and URLs
|
|
\App::singleton('consumables_upload_path', function () {
|
|
return 'consumables/';
|
|
});
|
|
|
|
\App::singleton('consumables_upload_url', function () {
|
|
return 'consumables/';
|
|
});
|
|
|
|
// Components paths and URLs
|
|
\App::singleton('components_upload_path', function () {
|
|
return 'components/';
|
|
});
|
|
|
|
\App::singleton('components_upload_url', function () {
|
|
return 'components/';
|
|
});
|
|
|
|
// 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()
|
|
{
|
|
}
|
|
}
|