Skip to content

A free open source IT asset/license management system

Apply pint to Providers directory

snipe8b658a19b918
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 146c8859ce..c01231b2f1 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -21,16 +21,19 @@ use App\Observers\LocationObserver;
use App\Observers\MaintenanceObserver;
use App\Observers\SettingObserver;
use App\Observers\UserObserver;
+use Illuminate\Pagination\Paginator;
use Illuminate\Routing\UrlGenerator;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
+use Rollbar\Laravel\RollbarServiceProvider;
/**
* This service provider handles setting the observers on models
*
* PHP version 5.5.9
+ *
* @version v3.0
*/
class AppServiceProvider extends ServiceProvider
@@ -39,7 +42,9 @@ class AppServiceProvider extends ServiceProvider
* Bootstrap application services.
*
* @author [A. Gianotto] [<[email protected]>]
+ *
* @since [v3.0]
+ *
* @return void
*/
public function boot(UrlGenerator $url)
@@ -51,23 +56,22 @@ class AppServiceProvider extends ServiceProvider
* regardless of how well the proxy or network is configured.
*
* We'll force the https scheme if the APP_URL starts with https://, or if APP_FORCE_TLS is set to true.
- *
*/
if ((strpos(env('APP_URL'), 'https://') === 0) || (env('APP_FORCE_TLS'))) {
$url->forceScheme('https');
}
// TODO - isn't it somehow 'gauche' to check the environment directly; shouldn't we be using config() somehow?
- if ( ! env('APP_ALLOW_INSECURE_HOSTS')) { // unless you set APP_ALLOW_INSECURE_HOSTS, you should PROHIBIT forging domain parts of URL via Host: headers
+ if (! env('APP_ALLOW_INSECURE_HOSTS')) { // unless you set APP_ALLOW_INSECURE_HOSTS, you should PROHIBIT forging domain parts of URL via Host: headers
$url_parts = parse_url(config('app.url'));
if ($url_parts && array_key_exists('scheme', $url_parts) && array_key_exists('host', $url_parts)) { // check for the *required* parts of a bare-minimum URL
URL::forceRootUrl(config('app.url'));
} else {
- Log::error("Your APP_URL in your .env is misconfigured - it is: ".config('app.url').". Many things will work strangely unless you fix it.");
+ Log::error('Your APP_URL in your .env is misconfigured - it is: '.config('app.url').'. Many things will work strangely unless you fix it.');
}
}
- \Illuminate\Pagination\Paginator::useBootstrap();
+ Paginator::useBootstrap();
Schema::defaultStringLength(191);
Accessory::observe(AccessoryObserver::class);
@@ -96,10 +100,10 @@ class AppServiceProvider extends ServiceProvider
// Only load rollbar if there is a rollbar key and the app is in production
if (($this->app->environment('production')) && (config('logging.channels.rollbar.access_token'))) {
- $this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
+ $this->app->register(RollbarServiceProvider::class);
}
$this->app->singleton('ArieTimmerman\Laravel\SCIMServer\SCIMConfig', SnipeSCIMConfig::class); // this overrides the default SCIM configuration with our own
-
+
}
}
diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php
index 02aa53f44d..7f47c0fab2 100644
--- a/app/Providers/AuthServiceProvider.php
+++ b/app/Providers/AuthServiceProvider.php
@@ -41,6 +41,9 @@ use App\Policies\UserPolicy;
use Carbon\Carbon;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
+use Laravel\Passport\Console\ClientCommand;
+use Laravel\Passport\Console\InstallCommand;
+use Laravel\Passport\Console\KeysCommand;
use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider
@@ -81,25 +84,23 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->commands([
- \Laravel\Passport\Console\InstallCommand::class,
- \Laravel\Passport\Console\ClientCommand::class,
- \Laravel\Passport\Console\KeysCommand::class,
+ InstallCommand::class,
+ ClientCommand::class,
+ KeysCommand::class,
]);
$this->registerPolicies();
- Passport::tokensExpireIn(Carbon::now()->addYears((int)config('passport.expiration_years')));
- Passport::refreshTokensExpireIn(Carbon::now()->addYears((int)config('passport.expiration_years')));
- Passport::personalAccessTokensExpireIn(Carbon::now()->addYears((int)config('passport.expiration_years')));
+ Passport::tokensExpireIn(Carbon::now()->addYears((int) config('passport.expiration_years')));
+ Passport::refreshTokensExpireIn(Carbon::now()->addYears((int) config('passport.expiration_years')));
+ Passport::personalAccessTokensExpireIn(Carbon::now()->addYears((int) config('passport.expiration_years')));
Passport::cookie(config('passport.cookie_name'));
-
/**
* BEFORE ANYTHING ELSE
*
* If this condition is true, ANYTHING else below will be assumed to be true.
* This is where we set the superadmin permission to allow superadmins to be able to do everything within the system.
- *
*/
Gate::before(function ($user, $ability) {
@@ -113,26 +114,23 @@ class AuthServiceProvider extends ServiceProvider
}
});
-
-
-
/**
* GENERAL GATES
*
* These control general sections of the admin. These definitions are used in our blades via @can('blah) and also
* use in our controllers to determine if a user has access to a certain area.
*/
-
Gate::define('canEditAuthFields', function ($user, $item) {
if ($item instanceof User) {
// if they can only edit users, deny them if the user is admin or superadmin
- if (!$user->isAdmin()) {
+ if (! $user->isAdmin()) {
if ($item->isAdmin() || $item->isSuperUser()) {
return false;
}
+
return true;
}
@@ -151,7 +149,6 @@ class AuthServiceProvider extends ServiceProvider
return false;
});
-
/**
* Define the demo mode gate so we have an easy way to use @can and Gate::allows()
*/
@@ -159,6 +156,7 @@ class AuthServiceProvider extends ServiceProvider
if (config('app.lock_passwords')) {
return false;
}
+
return true;
});
@@ -193,7 +191,6 @@ class AuthServiceProvider extends ServiceProvider
}
});
-
Gate::define('licenses.files', function ($user) {
if ($user->hasAccess('licenses.files')) {
return true;
@@ -201,7 +198,7 @@ class AuthServiceProvider extends ServiceProvider
});
Gate::define('assets.view.encrypted_custom_fields', function ($user) {
- if($user->hasAccess('assets.view.encrypted_custom_fields')){
+ if ($user->hasAccess('assets.view.encrypted_custom_fields')) {
return true;
}
});
@@ -249,7 +246,7 @@ class AuthServiceProvider extends ServiceProvider
return $user->hasAccess('self.view_purchase_cost');
});
- // This is largely used to determine whether to display the gear icon sidenav
+ // This is largely used to determine whether to display the gear icon sidenav
// in the left-side navigation
Gate::define('backend.interact', function ($user) {
return $user->can('view', Statuslabel::class)
@@ -266,36 +263,33 @@ class AuthServiceProvider extends ServiceProvider
|| $user->can('view', Depreciation::class);
});
-
// This determines whether or not an API user should be able to get the selectlists.
// This can seem a little confusing, since view properties may not have been granted
- // to the logged in API user, but creating assets, licenses, etc won't work
+ // to the logged in API user, but creating assets, licenses, etc won't work
// if the user can't view and interact with the select lists.
Gate::define('view.selectlists', function ($user) {
- return $user->can('update', Asset::class)
- || $user->can('create', Asset::class)
+ return $user->can('update', Asset::class)
+ || $user->can('create', Asset::class)
|| $user->can('checkout', Asset::class)
|| $user->can('checkin', Asset::class)
- || $user->can('audit', Asset::class)
- || $user->can('update', License::class)
- || $user->can('create', License::class)
+ || $user->can('audit', Asset::class)
+ || $user->can('update', License::class)
+ || $user->can('create', License::class)
|| $user->can('update', Component::class)
- || $user->can('create', Component::class)
- || $user->can('update', Consumable::class)
- || $user->can('create', Consumable::class)
+ || $user->can('create', Component::class)
+ || $user->can('update', Consumable::class)
+ || $user->can('create', Consumable::class)
|| $user->can('update', Accessory::class)
- || $user->can('create', Accessory::class)
+ || $user->can('create', Accessory::class)
|| $user->can('update', User::class)
|| $user->can('create', User::class)
|| ($user->hasAccess('reports.view'));
});
-
// This determines whether the user can edit their profile based on the setting in Admin > General
Gate::define('self.profile', function ($user) {
return $user->canEditProfile();
});
-
}
}
diff --git a/app/Providers/BladeServiceProvider.php b/app/Providers/BladeServiceProvider.php
index 024ee9d3dc..3225a8b35e 100644
--- a/app/Providers/BladeServiceProvider.php
+++ b/app/Providers/BladeServiceProvider.php
@@ -20,6 +20,6 @@ class BladeServiceProvider extends ServiceProvider
*/
public function boot(): void
{
- Blade::anonymousComponentPath(__DIR__ . '/../../resources/views/blade');
+ Blade::anonymousComponentPath(__DIR__.'/../../resources/views/blade');
}
}
diff --git a/app/Providers/BreadcrumbsServiceProvider.php b/app/Providers/BreadcrumbsServiceProvider.php
index a30837f524..cb583ab548 100644
--- a/app/Providers/BreadcrumbsServiceProvider.php
+++ b/app/Providers/BreadcrumbsServiceProvider.php
@@ -1,8 +1,9 @@
-<?php namespace App\Providers;
+<?php
+
+namespace App\Providers;
use App\Models\Accessory;
use App\Models\Asset;
-use App\Models\Maintenance;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Company;
@@ -14,8 +15,8 @@ use App\Models\Department;
use App\Models\Depreciation;
use App\Models\Group;
use App\Models\License;
-use App\Models\LicenseSeat;
use App\Models\Location;
+use App\Models\Maintenance;
use App\Models\Manufacturer;
use App\Models\PredefinedKit;
use App\Models\Statuslabel;
@@ -27,225 +28,178 @@ use Tabuna\Breadcrumbs\Trail;
class BreadcrumbsServiceProvider extends ServiceProvider
{
-/**
-* Handles the resource routes for first-class objects
-*
-* @return void
-*/
+ /**
+ * Handles the resource routes for first-class objects
+ *
+ * @return void
+ */
public function boot()
{
// Default home
- Breadcrumbs::for('home', fn (Trail $trail) =>
- $trail->push('<x-icon type="home" /><span class="sr-only">'.trans('general.dashboard').'</span>', route('home'))
+ Breadcrumbs::for('home', fn (Trail $trail) => $trail->push('<x-icon type="home" /><span class="sr-only">'.trans('general.dashboard').'</span>', route('home'))
);
/**
* Asset Breadcrumbs
*/
+ if ((request()->is('hardware*')) && (request()->status != '')) {
+ Breadcrumbs::for('hardware.index', fn (Trail $trail) => $trail->parent('home', route('home'))
+ ->push(trans('general.assets'), route('hardware.index'))
+ ->push(trans('general.'.strtolower(e(request()->status))), route('hardware.index', ['status' => request()->status]))
+ );
+ } else {
+ Breadcrumbs::for('hardware.index', fn (Trail $trail) => $trail->parent('home', route('home'))
+ ->push(trans('general.assets'), route('hardware.index'))
+ );
+ }
- if ((request()->is('hardware*')) && (request()->status!='')) {
- Breadcrumbs::for('hardware.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
- ->push(trans('general.assets'), route('hardware.index'))
- ->push(trans('general.'.strtolower(e(request()->status))), route('hardware.index', ['status' => request()->status]))
- );
-
- } else {
- Breadcrumbs::for('hardware.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
- ->push(trans('general.assets'), route('hardware.index'))
- );
- }
-
-
-
-
- Breadcrumbs::for('hardware.create', fn (Trail $trail) =>
- $trail->parent('hardware.index', route('hardware.index'))
- ->push(trans('general.create'), route('hardware.create'))
+ Breadcrumbs::for('hardware.create', fn (Trail $trail) => $trail->parent('hardware.index', route('hardware.index'))
+ ->push(trans('general.create'), route('hardware.create'))
);
- Breadcrumbs::for('clone/hardware', fn (Trail $trail) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ Breadcrumbs::for('clone/hardware', fn (Trail $trail) => $trail->parent('hardware.index', route('hardware.index'))
->push(trans('admin/hardware/general.clone'), route('hardware.create'))
);
- Breadcrumbs::for('hardware.show', fn (Trail $trail, Asset $asset) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ Breadcrumbs::for('hardware.show', fn (Trail $trail, Asset $asset) => $trail->parent('hardware.index', route('hardware.index'))
->push($asset->display_name, route('hardware.show', $asset))
);
- Breadcrumbs::for('hardware.edit', fn (Trail $trail, Asset $asset) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ Breadcrumbs::for('hardware.edit', fn (Trail $trail, Asset $asset) => $trail->parent('hardware.index', route('hardware.index'))
->push($asset->display_name, route('hardware.show', $asset))
->push(trans('general.update'))
);
-
/**
* Asset Model Breadcrumbs
*/
-
- if ((request()->is('models*')) && (request()->status=='deleted')) {
- Breadcrumbs::for('models.index', fn (Trail $trail) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ if ((request()->is('models*')) && (request()->status == 'deleted')) {
+ Breadcrumbs::for('models.index', fn (Trail $trail) => $trail->parent('hardware.index', route('hardware.index'))
->push(trans('general.asset_models'), route('models.index'))
->push(trans('general.deleted_models'), route('models.index', ['status' => request()->status]))
);
} else {
- Breadcrumbs::for('models.index', fn (Trail $trail) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ Breadcrumbs::for('models.index', fn (Trail $trail) => $trail->parent('hardware.index', route('hardware.index'))
->push(trans('general.asset_models'), route('models.index'))
);
}
-
- Breadcrumbs::for('models.create', fn (Trail $trail) =>
- $trail->parent('models.index', route('models.index'))
+ Breadcrumbs::for('models.create', fn (Trail $trail) => $trail->parent('models.index', route('models.index'))
->push(trans('general.create'), route('models.create'))
);
- Breadcrumbs::for('models.show', fn (Trail $trail, AssetModel $model) =>
- $trail->parent('models.index', route('models.index'))
+ Breadcrumbs::for('models.show', fn (Trail $trail, AssetModel $model) => $trail->parent('models.index', route('models.index'))
->push($model->name, route('models.show', $model))
);
- Breadcrumbs::for('models.edit', fn (Trail $trail, AssetModel $model) =>
- $trail->parent('models.index', route('models.index'))
+ Breadcrumbs::for('models.edit', fn (Trail $trail, AssetModel $model) => $trail->parent('models.index', route('models.index'))
->push($model->display_name, route('models.show', $model))
->push(trans('general.update'))
);
-
/**
* Accessories Breadcrumbs
*/
- Breadcrumbs::for('accessories.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('accessories.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.accessories'), route('accessories.index'))
);
- Breadcrumbs::for('accessories.create', fn (Trail $trail) =>
- $trail->parent('accessories.index', route('accessories.index'))
+ Breadcrumbs::for('accessories.create', fn (Trail $trail) => $trail->parent('accessories.index', route('accessories.index'))
->push(trans('general.create'), route('accessories.create'))
);
- Breadcrumbs::for('accessories.show', fn (Trail $trail, Accessory $accessory) =>
- $trail->parent('accessories.index', route('accessories.index'))
+ Breadcrumbs::for('accessories.show', fn (Trail $trail, Accessory $accessory) => $trail->parent('accessories.index', route('accessories.index'))
->push($accessory->name, route('accessories.show', $accessory))
);
- Breadcrumbs::for('accessories.edit', fn (Trail $trail, Accessory $accessory) =>
- $trail->parent('accessories.index', route('accessories.index'))
+ Breadcrumbs::for('accessories.edit', fn (Trail $trail, Accessory $accessory) => $trail->parent('accessories.index', route('accessories.index'))
->push($accessory->display_name, route('accessories.show', $accessory))
->push(trans('general.update'))
);
-
/**
* Categories Breadcrumbs
*/
- Breadcrumbs::for('categories.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('categories.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.categories'), route('categories.index'))
);
- Breadcrumbs::for('categories.create', fn (Trail $trail) =>
- $trail->parent('categories.index', route('categories.index'))
+ Breadcrumbs::for('categories.create', fn (Trail $trail) => $trail->parent('categories.index', route('categories.index'))
->push(trans('general.create'), route('categories.create'))
);
- Breadcrumbs::for('categories.show', fn (Trail $trail, Category $category) =>
- $trail->parent('categories.index', route('categories.index'))
+ Breadcrumbs::for('categories.show', fn (Trail $trail, Category $category) => $trail->parent('categories.index', route('categories.index'))
->push($category->name, route('categories.show', $category))
);
- Breadcrumbs::for('categories.edit', fn (Trail $trail, Category $category) =>
- $trail->parent('categories.index', route('categories.index'))
+ Breadcrumbs::for('categories.edit', fn (Trail $trail, Category $category) => $trail->parent('categories.index', route('categories.index'))
->push($category->display_name, route('categories.show', $category))
->push(trans('general.update'))
);
-
-
/**
* Company Breadcrumbs
*/
- Breadcrumbs::for('companies.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('companies.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.companies'), route('companies.index'))
);
- Breadcrumbs::for('companies.create', fn (Trail $trail) =>
- $trail->parent('companies.index', route('companies.index'))
+ Breadcrumbs::for('companies.create', fn (Trail $trail) => $trail->parent('companies.index', route('companies.index'))
->push(trans('general.create'), route('companies.create'))
);
- Breadcrumbs::for('companies.show', fn (Trail $trail, Company $company) =>
- $trail->parent('companies.index', route('companies.index'))
+ Breadcrumbs::for('companies.show', fn (Trail $trail, Company $company) => $trail->parent('companies.index', route('companies.index'))
->push($company->name, route('companies.show', $company))
);
- Breadcrumbs::for('companies.edit', fn (Trail $trail, Company $company) =>
- $trail->parent('companies.index', route('companies.index'))
+ Breadcrumbs::for('companies.edit', fn (Trail $trail, Company $company) => $trail->parent('companies.index', route('companies.index'))
->push($company->display_name, route('companies.show', $company))
->push(trans('general.update'))
);
-
/**
* Components Breadcrumbs
*/
- Breadcrumbs::for('components.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('components.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.components'), route('components.index'))
);
- Breadcrumbs::for('components.create', fn (Trail $trail) =>
- $trail->parent('components.index', route('components.index'))
+ Breadcrumbs::for('components.create', fn (Trail $trail) => $trail->parent('components.index', route('components.index'))
->push(trans('general.create'), route('components.create'))
);
- Breadcrumbs::for('components.show', fn (Trail $trail, Component $component) =>
- $trail->parent('components.index', route('components.index'))
+ Breadcrumbs::for('components.show', fn (Trail $trail, Component $component) => $trail->parent('components.index', route('components.index'))
->push($component->name, route('components.show', $component))
);
- Breadcrumbs::for('components.edit', fn (Trail $trail, Component $component) =>
- $trail->parent('components.index', route('components.index'))
+ Breadcrumbs::for('components.edit', fn (Trail $trail, Component $component) => $trail->parent('components.index', route('components.index'))
->push($component->display_name, route('components.show', $component))
->push(trans('general.update'))
);
- Breadcrumbs::for('components.clone.create', fn (Trail $trail, Component $component) =>
- $trail->parent('components.index', route('components.index'))
+ Breadcrumbs::for('components.clone.create', fn (Trail $trail, Component $component) => $trail->parent('components.index', route('components.index'))
->push($component->display_name, route('components.show', $component))
->push(trans('general.clone'), route('components.create'))
);
-
/**
* Consumables Breadcrumbs
*/
- Breadcrumbs::for('consumables.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('consumables.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.consumables'), route('consumables.index'))
);
- Breadcrumbs::for('consumables.create', fn (Trail $trail) =>
- $trail->parent('consumables.index', route('consumables.index'))
+ Breadcrumbs::for('consumables.create', fn (Trail $trail) => $trail->parent('consumables.index', route('consumables.index'))
->push(trans('general.create'), route('consumables.create'))
);
- Breadcrumbs::for('consumables.show', fn (Trail $trail, Consumable $consumable) =>
- $trail->parent('consumables.index', route('consumables.index'))
+ Breadcrumbs::for('consumables.show', fn (Trail $trail, Consumable $consumable) => $trail->parent('consumables.index', route('consumables.index'))
->push($consumable->name, route('consumables.show', $consumable))
);
- Breadcrumbs::for('consumables.edit', fn (Trail $trail, Consumable $consumable) =>
- $trail->parent('consumables.index', route('consumables.index'))
+ Breadcrumbs::for('consumables.edit', fn (Trail $trail, Consumable $consumable) => $trail->parent('consumables.index', route('consumables.index'))
->push($consumable->display_name, route('consumables.show', $consumable))
->push(trans('general.update'))
);
@@ -253,38 +207,30 @@ class BreadcrumbsServiceProvider extends ServiceProvider
/**
* Custom fields Breadcrumbs
*/
- Breadcrumbs::for('fields.index', fn (Trail $trail) =>
- $trail->parent('models.index', route('models.index'))
+ Breadcrumbs::for('fields.index', fn (Trail $trail) => $trail->parent('models.index', route('models.index'))
->push(trans('admin/custom_fields/general.custom_fields'), route('fields.index'))
);
- Breadcrumbs::for('fields.create', fn (Trail $trail) =>
- $trail->parent('fields.index', route('fields.index'))
+ Breadcrumbs::for('fields.create', fn (Trail $trail) => $trail->parent('fields.index', route('fields.index'))
->push(trans('general.create'), route('fields.create'))
);
- Breadcrumbs::for('fields.edit', fn (Trail $trail, CustomField $field) =>
- $trail->parent('fields.index', route('fields.index'))
+ Breadcrumbs::for('fields.edit', fn (Trail $trail, CustomField $field) => $trail->parent('fields.index', route('fields.index'))
->push(trans('general.update')) // We skip the show section here since there isn't really a concept of fields.show
);
/**
* Custom fieldsets Breadcrumbs
*/
-
- Breadcrumbs::for('fieldsets.create', fn (Trail $trail) =>
- $trail->parent('fields.index', route('fields.index'))
+ Breadcrumbs::for('fieldsets.create', fn (Trail $trail) => $trail->parent('fields.index', route('fields.index'))
->push(trans('admin/custom_fields/general.create_fieldset'), route('fieldsets.create'))
);
-
- Breadcrumbs::for('fieldsets.show', fn (Trail $trail, CustomFieldset $fieldset) =>
- $trail->parent('fields.index', route('fields.index'))
+ Breadcrumbs::for('fieldsets.show', fn (Trail $trail, CustomFieldset $fieldset) => $trail->parent('fields.index', route('fields.index'))
->push($fieldset->name, route('fields.index'))
);
- Breadcrumbs::for('fieldsets.edit', fn (Trail $trail, CustomFieldset $fieldset) =>
- $trail->parent('fields.index', route('fields.index'))
+ Breadcrumbs::for('fieldsets.edit', fn (Trail $trail, CustomFieldset $fieldset) => $trail->parent('fields.index', route('fields.index'))
->push($fieldset->display_name, route('fieldsets.show', $fieldset))
->push(trans('general.update'))
);
@@ -292,48 +238,39 @@ class BreadcrumbsServiceProvider extends ServiceProvider
/**
* Department Breadcrumbs
*/
- Breadcrumbs::for('departments.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('departments.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.departments'), route('departments.index'))
);
- Breadcrumbs::for('departments.create', fn (Trail $trail) =>
- $trail->parent('departments.index', route('departments.index'))
+ Breadcrumbs::for('departments.create', fn (Trail $trail) => $trail->parent('departments.index', route('departments.index'))
->push(trans('general.create'), route('departments.create'))
);
- Breadcrumbs::for('departments.show', fn (Trail $trail, Department $department) =>
- $trail->parent('departments.index', route('departments.index'))
+ Breadcrumbs::for('departments.show', fn (Trail $trail, Department $department) => $trail->parent('departments.index', route('departments.index'))
->push($department->name, route('home'))
);
- Breadcrumbs::for('departments.edit', fn (Trail $trail, Department $department) =>
- $trail->parent('departments.index', route('departments.index'))
+ Breadcrumbs::for('departments.edit', fn (Trail $trail, Department $department) => $trail->parent('departments.index', route('departments.index'))
->push($department->display_name, route('departments.show', $department))
->push(trans('general.update'))
);
-
/**
* Department Breadcrumbs
*/
- Breadcrumbs::for('depreciations.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('depreciations.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.depreciations'), route('depreciations.index'))
);
- Breadcrumbs::for('depreciations.create', fn (Trail $trail) =>
- $trail->parent('depreciations.index', route('depreciations.index'))
+ Breadcrumbs::for('depreciations.create', fn (Trail $trail) => $trail->parent('depreciations.index', route('depreciations.index'))
->push(trans('general.create'), route('depreciations.create'))
);
- Breadcrumbs::for('depreciations.show', fn (Trail $trail, Depreciation $depreciation) =>
- $trail->parent('depreciations.index', route('depreciations.index'))
+ Breadcrumbs::for('depreciations.show', fn (Trail $trail, Depreciation $depreciation) => $trail->parent('depreciations.index', route('depreciations.index'))
->push($depreciation->name, route('depreciations.show', $depreciation))
);
- Breadcrumbs::for('depreciations.edit', fn (Trail $trail, Depreciation $depreciation) =>
- $trail->parent('depreciations.index', route('depreciations.index'))
+ Breadcrumbs::for('depreciations.edit', fn (Trail $trail, Depreciation $depreciation) => $trail->parent('depreciations.index', route('depreciations.index'))
->push($depreciation->display_name, route('depreciations.show', $depreciation))
->push(trans('general.update'))
);
@@ -341,92 +278,75 @@ class BreadcrumbsServiceProvider extends ServiceProvider
/**
* Groups Breadcrumbs
*/
- Breadcrumbs::for('groups.index', fn (Trail $trail) =>
- $trail->parent('settings.index', route('settings.index'))
+ Breadcrumbs::for('groups.index', fn (Trail $trail) => $trail->parent('settings.index', route('settings.index'))
->push(trans('general.groups'), route('groups.index'))
);
- Breadcrumbs::for('groups.create', fn (Trail $trail) =>
- $trail->parent('groups.index', route('groups.index'))
+ Breadcrumbs::for('groups.create', fn (Trail $trail) => $trail->parent('groups.index', route('groups.index'))
->push(trans('general.create'), route('groups.create'))
);
- Breadcrumbs::for('groups.show', fn (Trail $trail, Group $group) =>
- $trail->parent('groups.index', route('groups.index'))
+ Breadcrumbs::for('groups.show', fn (Trail $trail, Group $group) => $trail->parent('groups.index', route('groups.index'))
->push($group->name, route('groups.show', $group))
);
- Breadcrumbs::for('groups.edit', fn (Trail $trail, Group $group) =>
- $trail->parent('groups.index', route('groups.index'))
+ Breadcrumbs::for('groups.edit', fn (Trail $trail, Group $group) => $trail->parent('groups.index', route('groups.index'))
->push($group->display_name, route('groups.show', $group))
->push(trans('general.update'))
);
-
/**
* Licenses Breadcrumbs
*/
- if ((request()->is('licenses*')) && (request()->status=='inactive')) {
- Breadcrumbs::for('licenses.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ if ((request()->is('licenses*')) && (request()->status == 'inactive')) {
+ Breadcrumbs::for('licenses.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.licenses'), route('licenses.index'))
->push(trans('general.show_inactive'), route('licenses.index'))
);
- } elseif ((request()->is('licenses*')) && (request()->status=='expiring')) {
- Breadcrumbs::for('licenses.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ } elseif ((request()->is('licenses*')) && (request()->status == 'expiring')) {
+ Breadcrumbs::for('licenses.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.licenses'), route('licenses.index'))
->push(trans('general.show_expiring'), route('licenses.index'))
);
} else {
- Breadcrumbs::for('licenses.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('licenses.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.licenses'), route('licenses.index'))
);
}
- Breadcrumbs::for('licenses.create', fn (Trail $trail) =>
- $trail->parent('licenses.index', route('licenses.index'))
+ Breadcrumbs::for('licenses.create', fn (Trail $trail) => $trail->parent('licenses.index', route('licenses.index'))
->push(trans('general.create'), route('licenses.create'))
);
- Breadcrumbs::for('licenses.show', fn (Trail $trail, License $license) =>
- $trail->parent('licenses.index', route('licenses.index'))
+ Breadcrumbs::for('licenses.show', fn (Trail $trail, License $license) => $trail->parent('licenses.index', route('licenses.index'))
->push($license->name, route('licenses.show', $license))
);
- Breadcrumbs::for('licenses.edit', fn (Trail $trail, License $license) =>
- $trail->parent('licenses.index', route('licenses.index'))
+ Breadcrumbs::for('licenses.edit', fn (Trail $trail, License $license) => $trail->parent('licenses.index', route('licenses.index'))
->push($license->display_name, route('licenses.show', $license))
->push(trans('general.update'))
);
-
/**
* Locations Breadcrumbs
*/
- Breadcrumbs::for('locations.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('locations.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.locations'), route('locations.index'))
);
- Breadcrumbs::for('locations.create', fn (Trail $trail) =>
- $trail->parent('locations.index', route('locations.index'))
+ Breadcrumbs::for('locations.create', fn (Trail $trail) => $trail->parent('locations.index', route('locations.index'))
->push(trans('general.create'), route('locations.create'))
);
- Breadcrumbs::for('clone/location', fn (Trail $trail) =>
- $trail->parent('locations.index', route('locations.index'))
+ Breadcrumbs::for('clone/location', fn (Trail $trail) => $trail->parent('locations.index', route('locations.index'))
->push(trans('admin/locations/table.clone'), route('locations.create'))
);
-
- Breadcrumbs::for('locations.show', fn (Trail $trail, Location $location) =>
- $trail->parent('locations.index', route('locations.index'))
+ Breadcrumbs::for('locations.show', fn (Trail $trail, Location $location) => $trail->parent('locations.index', route('locations.index'))
->push($location->name, route('locations.show', $location))
);
- Breadcrumbs::for('locations.edit', fn (Trail $trail, Location $location) =>
- $trail->parent('locations.index', route('locations.index'))
+ Breadcrumbs::for('locations.edit', fn (Trail $trail, Location $location) => $trail->parent('locations.index', route('locations.index'))
->push($location->display_name, route('locations.show', $location))
->push(trans('general.update'))
);
@@ -434,199 +354,160 @@ class BreadcrumbsServiceProvider extends ServiceProvider
/**
* Maintenances Breadcrumbs
*/
- Breadcrumbs::for('maintenances.index', fn (Trail $trail) =>
- $trail->parent('hardware.index', route('hardware.index'))
+ Breadcrumbs::for('maintenances.index', fn (Trail $trail) => $trail->parent('hardware.index', route('hardware.index'))
->push(trans('general.maintenances'), route('maintenances.index'))
);
- Breadcrumbs::for('maintenances.create', fn (Trail $trail) =>
- $trail->parent('maintenances.index', route('maintenances.index'))
+ Breadcrumbs::for('maintenances.create', fn (Trail $trail) => $trail->parent('maintenances.index', route('maintenances.index'))
->push(trans('general.create'), route('maintenances.create'))
);
- Breadcrumbs::for('maintenances.show', fn (Trail $trail, Maintenance $maintenance) =>
- $trail->parent('maintenances.index', route('maintenances.index'))
+ Breadcrumbs::for('maintenances.show', fn (Trail $trail, Maintenance $maintenance) => $trail->parent('maintenances.index', route('maintenances.index'))
->push($maintenance->name, route('maintenances.show', $maintenance))
);
- Breadcrumbs::for('maintenances.edit', fn (Trail $trail, Maintenance $maintenance) =>
- $trail->parent('maintenances.index', route('maintenances.index'))
+ Breadcrumbs::for('maintenances.edit', fn (Trail $trail, Maintenance $maintenance) => $trail->parent('maintenances.index', route('maintenances.index'))
->push($maintenance->display_name, route('maintenances.show', $maintenance))
->push(trans('general.update'))
);
-
/**
* Manufacturers Breadcrumbs
*/
- Breadcrumbs::for('manufacturers.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('manufacturers.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.manufacturers'), route('manufacturers.index'))
);
- Breadcrumbs::for('manufacturers.create', fn (Trail $trail) =>
- $trail->parent('manufacturers.index', route('manufacturers.index'))
+ Breadcrumbs::for('manufacturers.create', fn (Trail $trail) => $trail->parent('manufacturers.index', route('manufacturers.index'))
->push(trans('general.create'), route('manufacturers.create'))
);
- Breadcrumbs::for('manufacturers.show', fn (Trail $trail, Manufacturer $manufacturer) =>
- $trail->parent('manufacturers.index', route('manufacturers.index'))
+ Breadcrumbs::for('manufacturers.show', fn (Trail $trail, Manufacturer $manufacturer) => $trail->parent('manufacturers.index', route('manufacturers.index'))
->push($manufacturer->name, route('home'))
);
- Breadcrumbs::for('manufacturers.edit', fn (Trail $trail, Manufacturer $manufacturer) =>
- $trail->parent('manufacturers.index', route('manufacturers.index'))
+ Breadcrumbs::for('manufacturers.edit', fn (Trail $trail, Manufacturer $manufacturer) => $trail->parent('manufacturers.index', route('manufacturers.index'))
->push($manufacturer->name, route('manufacturers.show', $manufacturer))
->push(trans('general.update'))
);
-
/**
* Predefined Kits Breadcrumbs
*/
- Breadcrumbs::for('kits.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('kits.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.kits'), route('kits.index'))
);
- Breadcrumbs::for('kits.create', fn (Trail $trail) =>
- $trail->parent('kits.index', route('kits.index'))
+ Breadcrumbs::for('kits.create', fn (Trail $trail) => $trail->parent('kits.index', route('kits.index'))
->push(trans('general.create'), route('kits.create'))
);
- Breadcrumbs::for('kits.show', fn (Trail $trail, PredefinedKit $kit) =>
- $trail->parent('kits.index', route('kits.index'))
+ Breadcrumbs::for('kits.show', fn (Trail $trail, PredefinedKit $kit) => $trail->parent('kits.index', route('kits.index'))
->push($kit->name, route('kits.show', $kit))
);
- Breadcrumbs::for('kits.edit', fn (Trail $trail, PredefinedKit $kit) =>
- $trail->parent('kits.index', route('kits.index'))
+ Breadcrumbs::for('kits.edit', fn (Trail $trail, PredefinedKit $kit) => $trail->parent('kits.index', route('kits.index'))
->push($kit->display_name, route('kits.show', $kit))
->push(trans('general.update'))
);
-
/**
* Status Labels Breadcrumbs
*/
- Breadcrumbs::for('statuslabels.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('statuslabels.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.status_labels'), route('statuslabels.index'))
);
- Breadcrumbs::for('statuslabels.create', fn (Trail $trail) =>
- $trail->parent('statuslabels.index', route('statuslabels.index'))
+ Breadcrumbs::for('statuslabels.create', fn (Trail $trail) => $trail->parent('statuslabels.index', route('statuslabels.index'))
->push(trans('general.create'), route('statuslabels.create'))
);
- Breadcrumbs::for('statuslabels.show', fn (Trail $trail, Statuslabel $statuslabel) =>
- $trail->parent('statuslabels.index', route('statuslabels.index'))
+ Breadcrumbs::for('statuslabels.show', fn (Trail $trail, Statuslabel $statuslabel) => $trail->parent('statuslabels.index', route('statuslabels.index'))
->push($statuslabel->name, route('statuslabels.show', $statuslabel))
);
- Breadcrumbs::for('statuslabels.edit', fn (Trail $trail, Statuslabel $statuslabel) =>
- $trail->parent('statuslabels.index', route('statuslabels.index'))
+ Breadcrumbs::for('statuslabels.edit', fn (Trail $trail, Statuslabel $statuslabel) => $trail->parent('statuslabels.index', route('statuslabels.index'))
->push($statuslabel->display_name, route('statuslabels.show', $statuslabel))
->push(trans('general.update'))
);
-
/**
* Settings Breadcrumbs
*/
- Breadcrumbs::for('settings.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('settings.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.admin'), route('settings.index'))
);
-
-
/**
* Suppliers Breadcrumbs
*/
- Breadcrumbs::for('suppliers.index', fn (Trail $trail) =>
- $trail->parent('home', route('home'))
+ Breadcrumbs::for('suppliers.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.suppliers'), route('suppliers.index'))
);
- Breadcrumbs::for('suppliers.create', fn (Trail $trail) =>
- $trail->parent('suppliers.index', route('suppliers.index'))
+ Breadcrumbs::for('suppliers.create', fn (Trail $trail) => $trail->parent('suppliers.index', route('suppliers.index'))
->push(trans('general.create'), route('suppliers.create'))
);
- Breadcrumbs::for('suppliers.show', fn (Trail $trail, Supplier $supplier) =>
- $trail->parent('suppliers.index', route('suppliers.index'))
+ Breadcrumbs::for('suppliers.show', fn (Trail $trail, Supplier $supplier) => $trail->parent('suppliers.index', route('suppliers.index'))
->push($supplier->name, route('home'))
);
- Breadcrumbs::for('suppliers.edit', fn (Trail $trail, Supplier $supplier) =>
- $trail->parent('suppliers.index', route('suppliers.index'))
+ Breadcrumbs::for('suppliers.edit', fn (Trail $trail, Supplier $supplier) => $trail->parent('suppliers.index', route('suppliers.index'))
->push($supplier->display_name, route('suppliers.show', $supplier))
->push(trans('general.update'))
);
-
-
/**
* Users Breadcrumbs
*/
- if ((request()->is('users*')) && (request()->status=='deleted')) {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ if ((request()->is('users*')) && (request()->status == 'deleted')) {
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
->push(trans('general.deleted_users'), route('users.index'))
);
- } elseif ((request()->is('users*')) && (request()->admins=='true')) {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ } elseif ((request()->is('users*')) && (request()->admins == 'true')) {
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
->push(trans('general.show_admins'), route('users.index'))
);
- } elseif ((request()->is('users*')) && (request()->superadmins=='true')) {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ } elseif ((request()->is('users*')) && (request()->superadmins == 'true')) {
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
->push(trans('general.show_superadmins'), route('users.index'))
);
- } elseif ((request()->is('users*')) && (request()->activated=='0')) {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ } elseif ((request()->is('users*')) && (request()->activated == '0')) {
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
->push(trans('general.login_disabled'), route('users.index'))
);
- } elseif ((request()->is('users*')) && (request()->activated=='1')) {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ } elseif ((request()->is('users*')) && (request()->activated == '1')) {
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
->push(trans('general.login_enabled'), route('users.index'))
);
} else {
- Breadcrumbs::for('users.index', fn(Trail $trail) => $trail->parent('home', route('home'))
+ Breadcrumbs::for('users.index', fn (Trail $trail) => $trail->parent('home', route('home'))
->push(trans('general.users'), route('users.index'))
);
}
- Breadcrumbs::for('users.create', fn (Trail $trail) =>
- $trail->parent('users.index', route('users.index'))
+ Breadcrumbs::for('users.create', fn (Trail $trail) => $trail->parent('users.index', route('users.index'))
->push(trans('general.create'), route('users.create'))
);
- Breadcrumbs::for('users.clone.show', fn (Trail $trail) =>
- $trail->parent('users.index', route('users.index'))
+ Breadcrumbs::for('users.clone.show', fn (Trail $trail) => $trail->parent('users.index', route('users.index'))
->push(trans('admin/users/general.clone'), route('users.create'))
);
-
-
- Breadcrumbs::for('users.show', fn (Trail $trail, User $user) =>
- $trail->parent('users.index', route('users.index'))
+ Breadcrumbs::for('users.show', fn (Trail $trail, User $user) => $trail->parent('users.index', route('users.index'))
->push($user->display_name ?? 'Missing Username!', route('users.show', $user))
);
- Breadcrumbs::for('users.edit', fn (Trail $trail, User $user) =>
- $trail->parent('users.index', route('users.index'))
+ Breadcrumbs::for('users.edit', fn (Trail $trail, User $user) => $trail->parent('users.index', route('users.index'))
->push($user->display_name, route('users.show', $user))
->push(trans('general.update'))
);
-
-
}
-
-
-}
\ No newline at end of file
+}
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index 9143cdc8f5..6a9fa20ab1 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -4,7 +4,9 @@ namespace App\Providers;
use App\Listeners\CheckoutableListener;
use App\Listeners\CheckoutablesCheckedOutInBulkListener;
+use App\Listeners\LogFailedLogin;
use App\Listeners\LogListener;
+use App\Listeners\LogSuccessfulLogin;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
@@ -16,11 +18,11 @@ class EventServiceProvider extends ServiceProvider
*/
protected $listen = [
'Illuminate\Auth\Events\Login' => [
- \App\Listeners\LogSuccessfulLogin::class,
+ LogSuccessfulLogin::class,
],
'Illuminate\Auth\Events\Failed' => [
- \App\Listeners\LogFailedLogin::class,
+ LogFailedLogin::class,
],
];
diff --git a/app/Providers/LivewireServiceProvider.php b/app/Providers/LivewireServiceProvider.php
index 740a1e79b5..8e0844503f 100644
--- a/app/Providers/LivewireServiceProvider.php
+++ b/app/Providers/LivewireServiceProvider.php
@@ -25,14 +25,14 @@ class LivewireServiceProvider extends ServiceProvider
if ($prefix === '') {
$prefix = trim((string) parse_url(config('app.url'), PHP_URL_PATH), '/');
}
- $prefix = $prefix === '' ? '' : '/' . $prefix;
+ $prefix = $prefix === '' ? '' : '/'.$prefix;
Livewire::setUpdateRoute(function ($handle) use ($prefix) {
- return Route::post($prefix . '/livewire/update', $handle);
+ return Route::post($prefix.'/livewire/update', $handle);
});
Livewire::setScriptRoute(function ($handle) use ($prefix) {
- return Route::get($prefix . '/livewire/livewire.js', $handle);
+ return Route::get($prefix.'/livewire/livewire.js', $handle);
});
}
}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 054ffabe3e..e8b3c33f6e 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -39,7 +39,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'web',
-// 'namespace' => $this->namespace, //okay, I don't know what this means, but somehow this might be a problem for us?
+ // 'namespace' => $this->namespace, //okay, I don't know what this means, but somehow this might be a problem for us?
], function ($router) {
require base_path('routes/web/hardware.php');
require base_path('routes/web/models.php');
@@ -66,7 +66,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'auth:api',
-// 'namespace' => $this->namespace, // this might also be a problem? I don't really know :/
+ // 'namespace' => $this->namespace, // this might also be a problem? I don't really know :/
'prefix' => 'api',
], function ($router) {
require base_path('routes/api.php');
diff --git a/app/Providers/SamlServiceProvider.php b/app/Providers/SamlServiceProvider.php
index c9e50dafe2..1be4809c0e 100644
--- a/app/Providers/SamlServiceProvider.php
+++ b/app/Providers/SamlServiceProvider.php
@@ -17,8 +17,8 @@ class SamlServiceProvider extends ServiceProvider
{
$this->app->singleton(Saml::class, Saml::class);
- Route::group(['namespace'=> 'App\Http\Controllers'], function () {
- Route::group(['prefix'=> 'saml'], function () {
+ Route::group(['namespace' => 'App\Http\Controllers'], function () {
+ Route::group(['prefix' => 'saml'], function () {
Route::get(
'metadata',
[
@@ -57,7 +57,5 @@ class SamlServiceProvider extends ServiceProvider
*
* @return void
*/
- public function register()
- {
- }
+ public function register() {}
}
diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php
index 2a3c78c9a6..187026bfaf 100644
--- a/app/Providers/SettingsServiceProvider.php
+++ b/app/Providers/SettingsServiceProvider.php
@@ -10,6 +10,7 @@ use Illuminate\Support\ServiceProvider;
* some common upload path and image urls.
*
* PHP version 5.5.9
+ *
* @version v3.0
*/
class SettingsServiceProvider extends ServiceProvider
@@ -18,7 +19,9 @@ class SettingsServiceProvider extends ServiceProvider
* Custom email array validation
*
* @author [A. Gianotto] [<[email protected]>]
+ *
* @since [v3.0]
+ *
* @return void
*/
public function boot()
@@ -29,7 +32,6 @@ class SettingsServiceProvider extends ServiceProvider
$view->with('snipeSettings', Setting::getSettings());
});
-
// Make sure the limit is actually set, is an integer and does not exceed system limits
app()->singleton('api_limit_value', function () {
$limit = config('app.max_results');
@@ -45,10 +47,10 @@ class SettingsServiceProvider extends ServiceProvider
// Make sure the offset is actually set and is an integer
app()->singleton('api_offset_value', function () {
$offset = intval(request('offset'));
+
return $offset;
});
-
/**
* Set some common variables so that they're globally available.
* The paths should always be public (versus private uploads)
@@ -56,7 +58,6 @@ class SettingsServiceProvider extends ServiceProvider
// Model paths and URLs
-
app()->singleton('eula_pdf_path', function () {
return 'eula_pdf_path/';
});
@@ -190,7 +191,7 @@ class SettingsServiceProvider extends ServiceProvider
// 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'));
-
+
}
/**
@@ -198,7 +199,5 @@ class SettingsServiceProvider extends ServiceProvider
*
* @return void
*/
- public function register()
- {
- }
+ public function register() {}
}
diff --git a/app/Providers/SnipeTranslationServiceProvider.php b/app/Providers/SnipeTranslationServiceProvider.php
index f0ff334484..65186fccfe 100644
--- a/app/Providers/SnipeTranslationServiceProvider.php
+++ b/app/Providers/SnipeTranslationServiceProvider.php
@@ -14,7 +14,7 @@ class SnipeTranslationServiceProvider extends TranslationServiceProvider
*/
public function register()
{
- //This is almost an *EXACT* carbon-copy of the TranslationServiceProvider, except with a modified Translator
+ // This is almost an *EXACT* carbon-copy of the TranslationServiceProvider, except with a modified Translator
$this->registerLoader();
$this->app->singleton('translator', function ($app) {
@@ -25,7 +25,7 @@ class SnipeTranslationServiceProvider extends TranslationServiceProvider
// configuration so we can easily get both of these values from there.
$locale = $app['config']['app.locale'];
- $trans = new SnipeTranslator($loader, $locale); //the ONLY changed line
+ $trans = new SnipeTranslator($loader, $locale); // the ONLY changed line
$trans->setFallback($app['config']['app.fallback_locale']);
diff --git a/app/Providers/ValidationServiceProvider.php b/app/Providers/ValidationServiceProvider.php
index 26bc9ada07..5ca667b73f 100644
--- a/app/Providers/ValidationServiceProvider.php
+++ b/app/Providers/ValidationServiceProvider.php
@@ -3,17 +3,17 @@
namespace App\Providers;
use App\Models\CustomField;
-use App\Models\Department;
use App\Models\Location;
use App\Models\Setting;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
+use Illuminate\Support\ServiceProvider;
/**
* This service provider handles a few custom validation rules.
*
* PHP version 5.5.9
+ *
* @version v3.0
*/
class ValidationServiceProvider extends ServiceProvider
@@ -22,7 +22,9 @@ class ValidationServiceProvider extends ServiceProvider
* Custom email array validation
*
* @author [A. Gianotto] [<[email protected]>]
+ *
* @since [v3.0]
+ *
* @return void
*/
public function boot()
@@ -34,11 +36,11 @@ class ValidationServiceProvider extends ServiceProvider
$array = explode(',', $value);
$email_to_validate = [];
- foreach ($array as $email) { //loop over values
+ foreach ($array as $email) { // loop over values
$email_to_validate['alert_email'][] = $email;
}
- $rules = ['alert_email.*'=>'email'];
+ $rules = ['alert_email.*' => 'email'];
$messages = [
'alert_email.*' => trans('validation.custom.email_array'),
];
@@ -48,7 +50,6 @@ class ValidationServiceProvider extends ServiceProvider
return $validator->passes();
});
-
/**
* Unique only if undeleted.
*
@@ -68,7 +69,7 @@ class ValidationServiceProvider extends ServiceProvider
if (count($parameters)) {
// This is a bit of a shim, but serial doesn't have any other rules around it other than that it's nullable
- if (($parameters[0]=='assets') && ($attribute == 'serial') && (Setting::getSettings()->unique_serial != '1')) {
+ if (($parameters[0] == 'assets') && ($attribute == 'serial') && (Setting::getSettings()->unique_serial != '1')) {
return true;
}
@@ -81,7 +82,7 @@ class ValidationServiceProvider extends ServiceProvider
return $count < 1;
}
});
-
+
/**
* Unique if undeleted for two columns
*
@@ -93,18 +94,17 @@ class ValidationServiceProvider extends ServiceProvider
* $parameters[2] - the name of the second field we're looking at
* $parameters[3] - the value that the request is passing for the second table we're
* checking for uniqueness across
- *
*/
Validator::extend('two_column_unique_undeleted', function ($attribute, $value, $parameters, $validator) {
if (count($parameters)) {
-
+
$count = DB::table($parameters[0])
->select('id')
->where($attribute, '=', $value)
->where('id', '!=', $parameters[1]);
- if ($parameters[3]!='') {
+ if ($parameters[3] != '') {
$count = $count->where($parameters[2], $parameters[3]);
}
@@ -115,7 +115,6 @@ class ValidationServiceProvider extends ServiceProvider
}
});
-
/**
* This is the validator replace static method that allows us to pass the $parameters of the table names
* into the translation string in validation.two_column_unique_undeleted for two_column_unique_undeleted
@@ -127,16 +126,16 @@ class ValidationServiceProvider extends ServiceProvider
* The $parameters passed coincide with the ones the two_column_unique_undeleted custom validator above
* uses, so $parameter[0] is the first table and so $parameter[2] is the second table.
*/
- Validator::replacer('two_column_unique_undeleted', function($message, $attribute, $rule, $parameters) {
+ Validator::replacer('two_column_unique_undeleted', function ($message, $attribute, $rule, $parameters) {
$message = str_replace(':table1', $parameters[0], $message);
$message = str_replace(':table2', $parameters[2], $message);
// Change underscores to spaces for a friendlier display
$message = str_replace('_', ' ', $message);
+
return $message;
});
-
// Prevent circular references
//
// Example usage in Location model where parent_id references another Location:
@@ -308,33 +307,33 @@ class ValidationServiceProvider extends ServiceProvider
}
$count = $count->count('name');
+
return $count < 1;
});
-
Validator::extend('not_array', function ($attribute, $value, $parameters, $validator) {
- return !is_array($value);
+ return ! is_array($value);
});
// This is only used in Models/CustomFieldset.php - it does automatic validation for checkboxes by making sure
// that the submitted values actually exist in the options.
- Validator::extend('checkboxes', function ($attribute, $value, $parameters, $validator){
+ Validator::extend('checkboxes', function ($attribute, $value, $parameters, $validator) {
$field = CustomField::where('db_column', $attribute)->first();
$options = $field->formatFieldValuesAsArray();
- if(is_array($value)) {
+ if (is_array($value)) {
$invalid = array_diff($value, $options);
- if(count($invalid) > 0) {
+ if (count($invalid) > 0) {
return false;
}
}
// for legacy, allows users to submit a comma separated string of options
- elseif(!is_array($value)) {
+ elseif (! is_array($value)) {
$exploded = array_map('trim', explode(',', $value));
$invalid = array_diff($exploded, $options);
- if(count($invalid) > 0) {
+ if (count($invalid) > 0) {
return false;
}
}
@@ -351,7 +350,7 @@ class ValidationServiceProvider extends ServiceProvider
});
// Validates that the company of the validated object matches the company of the location in case of scoped locations
- Validator::extend('fmcs_location', function ($attribute, $value, $parameters, $validator){
+ Validator::extend('fmcs_location', function ($attribute, $value, $parameters, $validator) {
$settings = Setting::getSettings();
if ($settings->full_multiple_companies_support == '1' && $settings->scope_locations_fmcs == '1') {
$company_id = array_get($validator->getData(), 'company_id');
@@ -361,6 +360,7 @@ class ValidationServiceProvider extends ServiceProvider
return false;
}
}
+
return true;
});
}
@@ -370,7 +370,5 @@ class ValidationServiceProvider extends ServiceProvider
*
* @return void
*/
- public function register()
- {
- }
+ public function register() {}
}