Compare commits

..

1 Commits

Author SHA1 Message Date
victoria aba3a0733d Update accessories-sample.csv 2026-02-12 15:16:06 -10:00
1125 changed files with 11604 additions and 65857 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ jobs:
- name: Upload Laravel logs as artifacts
if: always()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: laravel-logs-php-${{ matrix.php-version }}-run-${{ github.run_attempt }}
path: |
+1 -1
View File
@@ -81,7 +81,7 @@ jobs:
- name: Upload Laravel logs as artifacts
if: always()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: laravel-logs-php-${{ matrix.php-version }}-run-${{ github.run_attempt }}
path: |
+1 -1
View File
@@ -67,7 +67,7 @@ jobs:
- name: Upload Laravel logs as artifacts
if: always()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: laravel-logs-php-${{ matrix.php-version }}-run-${{ github.run_attempt }}
path: |
@@ -113,7 +113,7 @@ class MoveUploadsToNewDisk extends Command
$filename = basename($private_upload[$x]);
try {
Storage::put($private_type . '/' . $filename, file_get_contents($private_upload[$x]));
Storage::put($private_type . '/' . $filename, file_get_contents($private_upload[$i]));
$new_url = Storage::url($private_type . '/' . $filename, $filename);
$this->info($type_count . '. PRIVATE: ' . $filename . ' was copied to ' . $new_url);
} catch (\Exception $e) {
@@ -1,24 +0,0 @@
<?php
namespace App\Events;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
class CheckoutablesCheckedOutInBulk
{
use Dispatchable, SerializesModels;
public function __construct(
public Collection $assets,
public Model $target,
public User $admin,
public string $checkout_at,
public string $expected_checkin,
public string $note,
) {
}
}
-2
View File
@@ -162,8 +162,6 @@ class Handler extends ExceptionHandler
$route = 'licenses.index';
} elseif (($route === 'customfieldsets.index') || ($route === 'customfields.index')) {
$route = 'fields.index';
} elseif ($route == 'actionlogs.index') {
$route = 'home';
}
return redirect()
+40 -3
View File
@@ -775,11 +775,11 @@ class Helper
public static function checkLowInventory()
{
$alert_threshold = \App\Models\Setting::getSettings()->alert_threshold;
$consumables = Consumable::withCount('consumableAssignments as consumables_users_count')->whereNotNull('min_amt')->get();
$consumables = Consumable::withCount('consumableAssignments as consumable_assignments_count')->whereNotNull('min_amt')->get();
$accessories = Accessory::withCount('checkouts as checkouts_count')->whereNotNull('min_amt')->get();
$components = Component::withCount('assets as sum_unconstrained_assets')->whereNotNull('min_amt')->get();
$components = Component::whereNotNull('min_amt')->get();
$asset_models = AssetModel::where('min_amt', '>', 0)->withCount(['availableAssets', 'assets'])->get();
$licenses = License::withCount('availCount as licenses_available')->where('min_amt', '>', 0)->get();
$licenses = License::where('min_amt', '>', 0)->get();
$items_array = [];
$all_count = 0;
@@ -1404,6 +1404,43 @@ class Helper
}
/**
* Generic helper (largely used by livewire right now) that returns the font-awesome icon
* for the object type.
*
* @author A. Gianotto <snipe@snipe.net>
* @since 6.1.0
*
* @return string
*/
public static function iconTypeByItem($item) {
switch ($item) {
case 'asset':
return 'fas fa-barcode';
case 'accessory':
return 'fas fa-keyboard';
case 'component':
return 'fas fa-hdd';
case 'consumable':
return 'fas fa-tint';
case 'license':
return 'far fa-save';
case 'location':
return 'fas fa-map-marker-alt';
case 'user':
return 'fas fa-user';
case 'supplier':
return 'fa-solid fa-store';
case 'manufacturer':
return 'fa-solid fa-building';
case 'category':
return 'fa-solid fa-table-columns';
}
}
/*
* This is a shorter way to see if the app is in demo mode.
*
+1 -9
View File
@@ -12,7 +12,6 @@ class IconHelper
case 'checkin':
return 'fa-solid fa-rotate-right';
case 'edit':
case 'update':
return 'fas fa-pencil-alt';
case 'clone':
return 'far fa-clone';
@@ -37,8 +36,6 @@ class IconHelper
return 'fa-solid fa-user';
case 'users':
return 'fas fa-users';
case 'supplier':
return 'fa-solid fa-store';
case 'restore':
return 'fa-solid fa-trash-arrow-up';
case 'external-link':
@@ -90,11 +87,8 @@ class IconHelper
case 'licenses':
case 'license':
return 'far fa-save';
case 'requests':
case 'requestable':
case 'request':
case 'requested':
return 'fa-solid fa-bell-concierge';
return 'fas fa-laptop';
case 'reports':
return 'fas fa-chart-bar';
case 'heart':
@@ -260,8 +254,6 @@ class IconHelper
case 'min-qty':
return 'fa-solid fa-chart-pie';
}
}
}
@@ -74,16 +74,16 @@ class AcceptanceController extends Controller
*/
public function store(Request $request, $id) : RedirectResponse
{
if (!$acceptance = CheckoutAcceptance::find($id)) {
return redirect()->route('account.accept')->with('error', trans('admin/hardware/message.does_not_exist'));
}
$acceptance = CheckoutAcceptance::find($id);
$assigned_user = User::find($acceptance->assigned_to_id);
$settings = Setting::getSettings();
$sig_filename='';
if (is_null($acceptance)) {
return redirect()->route('account.accept')->with('error', trans('admin/hardware/message.does_not_exist'));
}
if (! $acceptance->isPending()) {
return redirect()->route('account.accept')->with('error', trans('admin/users/message.error.asset_already_accepted'));
}
@@ -53,7 +53,6 @@ class AccessoriesController extends Controller
'company_id',
'notes',
'checkouts_count',
'order_number',
'qty',
// These are *relationships* so we wouldn't normally include them in this array,
// since they would normally create a `column not found` error,
@@ -92,10 +91,6 @@ class AccessoriesController extends Controller
$accessories->where('accessories.company_id', '=', $request->input('company_id'));
}
if ($request->filled('order_number')) {
$accessories->where('accessories.order_number', '=', $request->input('order_number'));
}
if ($request->filled('category_id')) {
$accessories->where('category_id', '=', $request->input('category_id'));
}
+10 -12
View File
@@ -154,15 +154,15 @@ class AssetsController extends Controller
}
$assets = Asset::select('assets.*')
// ->addSelect([
// 'first_checkout_at' => Actionlog::query()
// ->select('created_at')
// ->whereColumn('item_id', 'assets.id')
// ->where('item_type', Asset::class)
// ->where('action_type', 'checkout')
// ->orderBy('created_at')
// ->limit(1),
// ])
->addSelect([
'first_checkout_at' => Actionlog::query()
->select('created_at')
->whereColumn('item_id', 'assets.id')
->where('item_type', Asset::class)
->where('action_type', 'checkout')
->orderBy('created_at')
->limit(1),
])
->with(
'model',
'location',
@@ -1148,9 +1148,7 @@ class AssetsController extends Controller
$payload = [
'id' => $asset->id,
'asset_tag' => $asset->asset_tag,
'note' => e($request->input('note')),
'status_label' => e($asset->assetstatus->display_name),
'status_type' => $asset->assetstatus->getStatuslabelType(),
'note' => $request->input('note'),
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date),
];
@@ -87,10 +87,6 @@ class ComponentsController extends Controller
$components->where('components.company_id', '=', $request->input('company_id'));
}
if ($request->filled('order_number')) {
$components->where('components.order_number', '=', $request->input('order_number'));
}
if ($request->filled('category_id')) {
$components->where('category_id', '=', $request->input('category_id'));
}
@@ -86,10 +86,6 @@ class ConsumablesController extends Controller
$consumables->where('consumables.company_id', '=', $request->input('company_id'));
}
if ($request->filled('order_number')) {
$consumables->where('consumables.order_number', '=', $request->input('order_number'));
}
if ($request->filled('category_id')) {
$consumables->where('category_id', '=', $request->input('category_id'));
}
@@ -98,52 +98,24 @@ class LicenseSeatsController extends Controller
*/
public function update(Request $request, $licenseId, $seatId) : JsonResponse | array
{
$validated = $this->validate($request, [
'assigned_to' => [
'sometimes',
'int',
'nullable',
'prohibits:asset_id',
// must be a valid user or null to unassign
function ($attribute, $value, $fail) {
if (!is_null($value) && !User::where('id', $value)->whereNull('deleted_at')->exists()) {
$fail('The selected assigned_to is invalid.');
}
},
],
'asset_id' => [
'sometimes',
'int',
'nullable',
'prohibits:assigned_to',
// must be a valid asset or null to unassign
function ($attribute, $value, $fail) {
if (!is_null($value) && !Asset::where('id', $value)->whereNull('deleted_at')->exists()) {
$fail('The selected asset_id is invalid.');
}
},
],
'notes' => 'sometimes|string|nullable',
]);
$this->authorize('checkout', License::class);
$licenseSeat = LicenseSeat::with(['license', 'asset', 'user'])->find($seatId);
if (!$licenseSeat) {
if (! $licenseSeat = LicenseSeat::find($seatId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat not found'));
}
$license = $licenseSeat->license;
$license = $licenseSeat->license()->first();
if (!$license || $license->id != intval($licenseId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat does not belong to the specified license'));
}
$oldUser = $licenseSeat->user;
$oldAsset = $licenseSeat->asset;
$oldUser = $licenseSeat->user()->first();
$oldAsset = $licenseSeat->asset()->first();
// attempt to update the license seat
$licenseSeat->fill($validated);
$licenseSeat->fill($request->all());
$licenseSeat->created_by = auth()->id();
// check if this update is a checkin operation
// 1. are relevant fields touched at all?
@@ -168,17 +140,12 @@ class LicenseSeatsController extends Controller
if ($licenseSeat->isDirty('assigned_to')) {
$target = $is_checkin ? $oldUser : User::find($licenseSeat->assigned_to);
}
if ($licenseSeat->isDirty('asset_id')) {
$target = $is_checkin ? $oldAsset : Asset::find($licenseSeat->asset_id);
}
if ($assignmentTouched && is_null($target)){
// if both asset_id and assigned_to are null then we are "checking-in"
// a related model that does not exist (possible purged or bad data).
if (!is_null($request->input('asset_id')) || !is_null($request->input('assigned_to'))) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Target not found'));
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Target not found'));
}
if ($licenseSeat->save()) {
@@ -188,7 +155,6 @@ class LicenseSeatsController extends Controller
$licenseSeat->unreassignable_seat = true;
$licenseSeat->save();
}
// todo: skip if target is null?
$licenseSeat->logCheckin($target, $licenseSeat->notes);
} else {
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
@@ -32,7 +32,7 @@ class LicensesController extends Controller
$licenses->ExpiredLicenses();
} elseif ($request->input('status')=='expiring') {
$licenses->ExpiringLicenses($settings->alert_interval);
} elseif ($request->input('status')=='active') {
} else {
$licenses->ActiveLicenses();
}
@@ -82,8 +82,6 @@ class MaintenancesController extends Controller
'location',
'is_warranty',
'status_label',
'model',
'model_number',
];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
@@ -102,12 +100,6 @@ class MaintenancesController extends Controller
case 'asset_name':
$maintenances = $maintenances->OrderByAssetName($order);
break;
case 'model':
$maintenances = $maintenances->OrderByAssetModelName($order);
break;
case 'model_number':
$maintenances = $maintenances->OrderByAssetModelNumber($order);
break;
case 'serial':
$maintenances = $maintenances->OrderByAssetSerial($order);
break;
@@ -188,7 +188,7 @@ class UploadedFilesController extends Controller
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::withTrashed()->find($id);
$this->authorize('update', $object);
$this->authorize('update', self::$map_object_type[$object_type]);
if (!$object) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_object')));
+17 -45
View File
@@ -450,18 +450,10 @@ class UsersController extends Controller
if ($request->has('permissions')) {
$permissions_array = $request->input('permissions');
// Strip out the superuser permission if the API user isn't a superadmin
if (! auth()->user()->isSuperUser()) {
if ((is_array($permissions_array)) && (array_key_exists('superuser', $permissions_array))) {
unset($permissions_array['superuser']);
}
unset($permissions_array['superuser']);
}
if (!auth()->user()->isAdmin()) {
if ((is_array($permissions_array)) && (array_key_exists('admin', $permissions_array))) {
unset($permissions_array['admin']);
}
}
$user->permissions = $permissions_array;
}
@@ -538,6 +530,8 @@ class UsersController extends Controller
*/
public function update(SaveUserRequest $request, User $user): JsonResponse
{
$this->authorize('update', User::class);
$this->authorize('update', $user);
/**
@@ -573,43 +567,11 @@ class UsersController extends Controller
$user->activated = $request->input('activated');
}
// We need to use has() instead of filled()
// here because we need to overwrite permissions
// if someone needs to null them out
if ($request->has('permissions')) {
$permissions_array = $request->input('permissions');
$orig_permissions_array = $user->decodePermissions();
// Strip out the individual superuser permission if the API user isn't a superadmin
if (!auth()->user()->isSuperUser()) {
if (is_array($orig_permissions_array)) {
if (array_key_exists('superuser', $orig_permissions_array)) {
$permissions_array['superuser'] = $orig_permissions_array['superuser'];
}
}
}
// Strip out the individual admin permission if the API user isn't an admin
if ((!auth()->user()->isAdmin()) && (!auth()->user()->isSuperUser())) {
if (is_array($orig_permissions_array)) {
if (array_key_exists('admin', $orig_permissions_array)) {
$permissions_array['admin'] = $orig_permissions_array['admin'];
}
}
}
// This is going to update the whole thing, not just what was passed
$user->permissions = $permissions_array;
}
}
// We need to use has() instead of filled()
// here because we need to overwrite permissions
// if someone needs to null them out
if ($request->filled('display_name')) {
$user->display_name = $request->input('display_name');
@@ -624,7 +586,17 @@ class UsersController extends Controller
}
if ($request->has('permissions')) {
$permissions_array = $request->input('permissions');
// Strip out the individual superuser permission if the API user isn't a superadmin
if (!auth()->user()->isSuperUser()) {
unset($permissions_array['superuser']);
}
$user->permissions = $permissions_array;
}
if ($request->has('location_id')) {
// Update the location of any assets checked out to this user
@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Assets;
use App\Events\CheckoutablesCheckedOutInBulk;
use App\Helpers\Helper;
use App\Http\Controllers\CheckInOutRequest;
use App\Http\Controllers\Controller;
@@ -13,7 +12,6 @@ use App\Models\Setting;
use App\View\Label;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Context;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
@@ -646,8 +644,6 @@ class BulkAssetsController extends Controller
*/
public function storeCheckout(AssetCheckoutRequest $request) : RedirectResponse | ModelNotFoundException
{
Context::add('action', 'bulk_asset_checkout');
$this->authorize('checkout', Asset::class);
try {
@@ -734,15 +730,6 @@ class BulkAssetsController extends Controller
});
if (! $errors) {
CheckoutablesCheckedOutInBulk::dispatch(
$assets,
$target,
$admin,
$checkout_at,
$expected_checkin,
e($request->get('note')),
);
// Redirect to the new asset page
return redirect()->to('hardware')->with('success', trans_choice('admin/hardware/message.multi-checkout.success', $asset_ids));
}
@@ -7,8 +7,8 @@ use App\Http\Requests\ImageUploadRequest;
use App\Models\Company;
use App\Models\Component;
use App\Helpers\Helper;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Log;
@@ -226,20 +226,6 @@ class ComponentsController extends Controller
public function show(Component $component)
{
$this->authorize('view', $component);
return view('components/view', compact('component'))->with('snipe_component', $component);
}
public function getClone(Component $component) : View | RedirectResponse
{
$this->authorize('create', Component::class);
$cloned_component = clone $component;
$cloned_component->id = null;
$cloned_component->deleted_at = null;
// Show the page
return view('components/edit')
->with('item', $cloned_component)
->with('component', $cloned_component);
return view('components/view', compact('component'));
}
}
+2 -3
View File
@@ -32,16 +32,15 @@ use App\Models\Location;
use App\Models\Maintenance;
use App\Models\Supplier;
use App\Models\User;
use App\Traits\DisablesDebugbar;
use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Auth;
abstract class Controller extends BaseController
{
use AuthorizesRequests, DisablesDebugbar, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
static $map_object_type = [
'accessories' => Accessory::class,
+6 -24
View File
@@ -28,41 +28,23 @@ class HealthController extends BaseController
*/
public function get()
{
try {
if (DB::select('select 2 + 2')) {
$db_status = 'ok';
} else {
$db_status = 'Could not connect to database';
return response()->json([
'status' => 'ok',
]);
}
} catch (\Exception $e) {
$db_status = 'Could not connect to database';
}
if (is_writable(storage_path('logs'))) {
$filesystem_status = 'ok';
} else {
$filesystem_status = 'Could not write to storage/logs';
}
if (($filesystem_status!='ok') || ($db_status!='ok')) {
\Log::error('Could not connect to database');
return response()->json([
'status' =>
[
'database' => $db_status,
'filesystem' => $filesystem_status,
]
'status' => 'database connection failed',
], 500);
}
return response()->json([
'status' => 'ok',
]);
}
}
@@ -315,8 +315,7 @@ class LicensesController extends Controller
public function getExportLicensesCsv()
{
$this->authorize('view', License::class);
$this->disableDebugbar();
\Debugbar::disable();
$response = new StreamedResponse(function () {
// Open output stream
+1 -1
View File
@@ -38,7 +38,7 @@ class ModalController extends Controller
if (in_array($type, $allowed_types)) {
$view = view("modals.{$type}");
$view = view("modals.${type}");
if ($type == "statuslabel") {
$view->with('statuslabel_types', Helper::statusTypeList());
@@ -19,8 +19,7 @@ class ReportTemplatesController extends Controller
$report = $request->user()->reportTemplates()->create([
'name' => $validated['name'],
'options' => $request->except(['_token', 'name', 'is_shared']),
'is_shared' => $request->has('is_shared'),
'options' => $request->except(['_token', 'name']),
]);
session()->flash('success', trans('admin/reports/message.create.success'));
@@ -46,12 +45,6 @@ class ReportTemplatesController extends Controller
{
$this->authorize('reports.view');
if ($reportTemplate->created_by != auth()->id()) {
return redirect()
->route('report-templates.show', $reportTemplate)
->withError(trans('general.report_not_editable'));
}
return view('reports/custom', [
'customfields' => CustomField::get(),
'template' => $reportTemplate,
@@ -62,29 +55,13 @@ class ReportTemplatesController extends Controller
{
$this->authorize('reports.view');
if ($reportTemplate->created_by != auth()->id()) {
return redirect()
->route('report-templates.show', $reportTemplate)
->withError(trans('general.report_not_editable'));
}
// Ignore "options" rules since data does not come in under that key...
$validated = $request->validate(Arr::except((new ReportTemplate)->getRules(), 'options'));
$properties = [
'name' => $request->input('name'),
'options' => Arr::except($request->all(), ['_token', 'id', 'name', 'is_shared']),
'is_shared' => $reportTemplate->is_shared,
];
if ($reportTemplate->created_by == $request->user()->id) {
$properties['is_shared'] = $request->boolean('is_shared');
}
$reportTemplate->fill($properties);
if ($reportTemplate->isInvalid()) {
return redirect()->back()->withInput()->withErrors($reportTemplate->getErrors());
}
$reportTemplate->save();
$reportTemplate->update([
'name' => $validated['name'],
'options' => $request->except(['_token', 'name']),
]);
session()->flash('success', trans('admin/reports/message.update.success'));
@@ -95,12 +72,6 @@ class ReportTemplatesController extends Controller
{
$this->authorize('reports.view');
if ($reportTemplate->creator()->isNot(auth()->user())) {
return redirect()
->route('report-templates.show', $reportTemplate)
->withError(trans('general.generic_model_not_found', ['model' => 'report template']));
}
$reportTemplate->delete();
return redirect()->route('reports/custom')
+4 -60
View File
@@ -40,7 +40,6 @@ use League\Csv\EscapeFormula;
use App\Http\Requests\CustomAssetReportRequest;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\RedirectResponse;
use function Livewire\before;
/**
* This controller handles all actions related to Reports for
@@ -243,8 +242,7 @@ class ReportsController extends Controller
ini_set('max_execution_time', 12000);
$this->authorize('reports.view');
$this->disableDebugbar();
\Debugbar::disable();
$response = new StreamedResponse(function () {
Log::debug('Starting streamed response');
@@ -439,8 +437,8 @@ class ReportsController extends Controller
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
$this->authorize('reports.view');
$this->disableDebugbar();
\Debugbar::disable();
$customfields = CustomField::get();
$response = new StreamedResponse(function () use ($customfields, $request) {
Log::debug('Starting streamed response');
@@ -454,10 +452,6 @@ class ReportsController extends Controller
$header = [];
if($request->filled('is_shared')) {
$header[] = trans('admin/reports/general.share_template');
}
if ($request->filled('id')) {
$header[] = trans('general.id');
}
@@ -555,14 +549,6 @@ class ReportsController extends Controller
$header[] = 'Username';
}
if ($request->filled('user_company')) {
$header[] = trans('admin/reports/general.custom_export.user_company');
}
if ($request->filled('email')) {
$header[] = 'Email';
}
if ($request->filled('employee_num')) {
$header[] = 'Employee No.';
}
@@ -603,10 +589,6 @@ class ReportsController extends Controller
$header[] = trans('admin/reports/general.custom_export.user_zip');
}
if ($request->filled('target_notes')) {
$header[] = trans('admin/reports/general.custom_export.target_notes');
}
if ($request->filled('status')) {
$header[] = trans('general.status');
}
@@ -664,14 +646,7 @@ class ReportsController extends Controller
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
Log::debug('Added headers: '.$executionTime);
if($request->filled('is_shared')) {
//to fill with logic for the report template and NOT the assets retrieved by the query
//do we scope here or??
}
$assets = Asset::select('assets.*')->with(
$assets = Asset::select('assets.*')->with(
'location', 'assetstatus', 'company', 'defaultLoc', 'assignedTo',
'model.category', 'model.manufacturer', 'supplier');
@@ -778,15 +753,9 @@ class ReportsController extends Controller
$assets->whereBetween('assets.updated_at', [$request->input('last_updated_start'), $request->input('last_updated_end')]);
}
if(($request->filled('last_updated_before'))){
$last_updated_window = Carbon::parse(today()->subDays($request->input('last_updated_before')));
$assets->where('assets.updated_at', '<' , $last_updated_window);
}
if ($request->filled('exclude_archived')) {
$assets->notArchived();
}
if ($request->input('deleted_assets') == 'include_deleted') {
$assets->withTrashed();
}
@@ -794,6 +763,7 @@ class ReportsController extends Controller
$assets->onlyTrashed();
}
Log::debug($assets->toSql());
$assets->orderBy('assets.id', 'ASC')->chunk(500, function ($assets) use ($handle, $customfields, $request) {
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
@@ -912,23 +882,6 @@ class ReportsController extends Controller
}
}
if ($request->filled('user_company')) {
if ($asset->checkedOutToUser()) {
$row[] = ($asset->assignedto->company) ? $asset->assignedto->company->display_name : '';
} else {
$row[] = ''; // Empty string if unassigned
}
}
if ($request->filled('email')) {
// Only works if we're checked out to a user, not anything else.
if ($asset->checkedOutToUser()) {
$row[] = ($asset->assignedto) ? $asset->assignedto->email : '';
} else {
$row[] = ''; // Empty string if unassigned
}
}
if ($request->filled('employee_num')) {
// Only works if we're checked out to a user, not anything else.
if ($asset->checkedOutToUser()) {
@@ -1010,15 +963,6 @@ class ReportsController extends Controller
}
}
if ($request->filled('target_notes')) {
if ($asset->checkedOutToUser()) {
$row[] = ($asset->assignedto) ? $asset->assignedto->notes : '';
} else {
$row[] = ''; // Empty string if unassigned
}
}
if ($request->filled('status')) {
$row[] = ($asset->assetstatus) ? $asset->assetstatus->name.' ('.$asset->present()->statusMeta.')' : '';
}
+14 -13
View File
@@ -403,23 +403,24 @@ class SettingsController extends Controller
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
// Check if the audit interval has changed - if it has, we want to update ALL of the assets audit dates
if ($request->input('audit_interval') != $setting->audit_interval) {
// Check if the audit interval has changed - if it has, check if we should update all of the assets audit dates
if ((($request->input('audit_interval') != $setting->audit_interval)) && ($request->input('update_existing_dates') == 1)) {
// This could be a negative number if the user is trying to set the audit interval to a lower number than it was before
$audit_diff_months = ((int)$request->input('audit_interval') - (int)($setting->audit_interval));
// This could be a negative number if the user is trying to set the audit interval to a lower number than it was before
$audit_diff_months = ((int)$request->input('audit_interval') - (int)($setting->audit_interval));
// Batch update the dates. We have to use this method to avoid time limit exceeded errors on very large datasets,
// but it DOES mean this change doesn't get logged in the action logs, since it skips the observer.
// @see https://stackoverflow.com/questions/54879160/laravel-observer-not-working-on-bulk-insert
$affected = Asset::whereNotNull('next_audit_date')
->whereNull('deleted_at')
->update(
['next_audit_date' => DB::raw('DATE_ADD(next_audit_date, INTERVAL '.$audit_diff_months.' MONTH)')]
);
Log::debug($affected .' assets affected by audit interval update');
// Batch update the dates. We have to use this method to avoid time limit exceeded errors on very large datasets,
// but it DOES mean this change doesn't get logged in the action logs, since it skips the observer.
// @see https://stackoverflow.com/questions/54879160/laravel-observer-not-working-on-bulk-insert
$affected = Asset::whereNotNull('next_audit_date')
->whereNull('deleted_at')
->update(
['next_audit_date' => DB::raw('DATE_ADD(next_audit_date, INTERVAL ' . $audit_diff_months . ' MONTH)')]
);
Log::debug($affected . ' assets affected by audit interval update');
}
$alert_email = rtrim($request->input('alert_email'), ',');
@@ -133,7 +133,7 @@ class UploadedFilesController extends Controller
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::withTrashed()->find($id);
$this->authorize('update', $object);
$this->authorize('update', self::$map_object_type[$object_type]);
if (!$object) {
return redirect()->back()->withFragment('files')->with('error',trans('general.file_upload_status.invalid_object'));
+3 -17
View File
@@ -122,22 +122,9 @@ class UsersController extends Controller
// Strip out the superuser permission if the user isn't a superadmin
$permissions_array = $request->input('permission');
// Strip out the individual superuser permission if the API user isn't a superadmin
if (!auth()->user()->isSuperUser()) {
if ((is_array($permissions_array)) && (array_key_exists('superuser', $permissions_array))) {
unset($permissions_array['superuser']);
}
if (! auth()->user()->isSuperUser()) {
unset($permissions_array['superuser']);
}
// Strip out the individual admin permission if the API user isn't an admin
if (!auth()->user()->isAdmin()) {
if ((is_array($permissions_array)) && (array_key_exists('admin', $permissions_array))) {
unset($permissions_array['admin']);
}
}
$user->permissions = json_encode($permissions_array);
// we have to invoke the form request here to handle image uploads
@@ -523,8 +510,7 @@ class UsersController extends Controller
public function getExportUserCsv()
{
$this->authorize('view', User::class);
$this->disableDebugbar();
\Debugbar::disable();
$response = new StreamedResponse(function () {
// Open output stream
@@ -206,7 +206,7 @@ class ViewAssetsController extends Controller
if ($fullItemType == Asset::class) {
$data['item_url'] = route('hardware.show', $item->id);
} else {
$data['item_url'] = route("view/{$itemType}", $item->id);
$data['item_url'] = route("view/${itemType}", $item->id);
}
$settings = Setting::getSettings();
+1 -1
View File
@@ -34,7 +34,7 @@ class SaveUserRequest extends FormRequest
{
$rules = [
'department_id' => 'nullable|integer|exists:departments,id',
'manager_id' => 'nullable|integer|exists:users,id',
'manager_id' => 'nullable|exists:users,id',
'company_id' => ['nullable', 'integer', 'exists:companies,id']
];
+2 -2
View File
@@ -104,7 +104,7 @@ class AssetsTransformer
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date, 'date'),
'deleted_at' => Helper::getFormattedDateObject($asset->deleted_at, 'datetime'),
'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'),
// 'first_checkout' => Helper::getFormattedDateObject($asset->first_checkout_at, 'datetime'),
'first_checkout' => Helper::getFormattedDateObject($asset->first_checkout_at, 'datetime'),
'age' => $asset->purchase_date ? $asset->purchase_date->locale(app()->getLocale())->diffForHumans() : '',
'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'),
'last_checkin' => Helper::getFormattedDateObject($asset->last_checkin, 'datetime'),
@@ -211,7 +211,7 @@ class AssetsTransformer
return $asset->assigned ? [
'id' => (int) $asset->assigned->id,
'username' => e($asset->assigned->username),
'name' => e($asset->assigned->display_name),
'name' => e($asset->assigned->getFullNameAttribute()),
'first_name'=> e($asset->assigned->first_name),
'last_name'=> ($asset->assigned->last_name) ? e($asset->assigned->last_name) : null,
'email'=> ($asset->assigned->email) ? e($asset->assigned->email) : null,
@@ -74,7 +74,6 @@ class ComponentsTransformer
'checkout' => Gate::allows('checkout', Component::class),
'checkin' => Gate::allows('checkin', Component::class),
'update' => Gate::allows('update', Component::class),
'clone' => Gate::allows('create', Component::class),
'delete' => $component->isDeletable(),
];
$array += $permissions_array;
@@ -44,7 +44,6 @@ class CustomFieldsTransformer
'db_column_name' => e($field->db_column_name()),
'format' => e($field->format),
'field_values' => ($field->field_values) ? e($field->field_values) : null,
'field_encrypted' => $field->field_encrypted,
'field_values_array' => ($field->field_values) ? explode("\r\n", e($field->field_values)) : null,
'type' => e($field->element),
'required' => (($field->pivot) && ($field->pivot->required=='1')) ? true : false,
@@ -63,7 +63,7 @@ class DepreciationReportTransformer
*/
if (($asset->model) && ($asset->model->depreciation) && ($asset->model->depreciation->months !== 0)) {
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
$monthly_depreciation =Helper::formatCurrencyOutput($asset->getMonthlyDepreciation());
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
}
else if($asset->model->eol !== null) {
@@ -37,8 +37,7 @@ class MaintenancesTransformer
'image' => ($assetmaintenance->image != '') ? Storage::disk('public')->url('maintenances/'.e($assetmaintenance->image)) : null,
'model' => (($assetmaintenance->asset) && ($assetmaintenance->asset->model)) ? [
'id' => (int) $assetmaintenance->asset->model->id,
'name'=> ($assetmaintenance->asset->model->name) ? e($assetmaintenance->asset->model->name) : null,
'model_number'=> ($assetmaintenance->asset->model->model_number) ? e($assetmaintenance->asset->model->model_number) : null,
'name'=> ($assetmaintenance->asset->model->name) ? e($assetmaintenance->asset->model->name).' '.e($assetmaintenance->asset->model->model_number) : null,
] : null,
'status_label' => (($assetmaintenance->asset) && ($assetmaintenance->asset->assetstatus)) ? [
'id' => (int) $assetmaintenance->asset->assetstatus->id,
@@ -40,7 +40,7 @@ class StatuslabelsTransformer
$permissions_array['available_actions'] = [
'update' => Gate::allows('update', Statuslabel::class) ? true : false,
'delete' => (Gate::allows('delete', Statuslabel::class) && ($statuslabel->isDeletable())) ? true : false,
'delete' => (Gate::allows('delete', Statuslabel::class) && ($statuslabel->assets_count == 0)) ? true : false,
];
$array += $permissions_array;
@@ -56,7 +56,7 @@ class SuppliersTransformer
$permissions_array['available_actions'] = [
'update' => Gate::allows('update', Supplier::class),
'delete' => (Gate::allows('delete', Supplier::class) && ($supplier->isDeletable())),
'delete' => (Gate::allows('delete', Supplier::class) && ($supplier->assets_count == 0) && ($supplier->licenses_count == 0) && ($supplier->accessories_count == 0)),
];
$array += $permissions_array;
+1 -1
View File
@@ -141,7 +141,7 @@ class UsersTransformer
'id' => (int) $user->id,
'image' => e($user->present()->gravatar) ?? null,
'type' => 'user',
'name' => e($user->display_name),
'name' => e($user->getFullNameAttribute()),
'first_name' => e($user->first_name),
'last_name' => e($user->last_name),
'username' => e($user->username),
-1
View File
@@ -70,7 +70,6 @@ class CategoryImporter extends ItemImporter
$this->item['use_default_eula'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'use_default_eula'))) == 1) ? 1 : 0;
$this->item['require_acceptance'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'require_acceptance'))) == 1) ? 1 : 0;
$this->item['checkin_email'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'checkin_email'))) == 1) ? 1 : 0;
$this->item['tag_color'] = trim($this->findCsvMatch($row, 'tag_color'));
Log::debug('Item array is: ');
-1
View File
@@ -72,7 +72,6 @@ class ManufacturerImporter extends ItemImporter
$this->item['support_url'] = trim($this->findCsvMatch($row, 'support_url'));
$this->item['warranty_lookup_url'] = trim($this->findCsvMatch($row, 'warranty_lookup_url'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
$this->item['tag_color'] = trim($this->findCsvMatch($row, 'tag_color'));
Log::debug('Item array is: ');
-1
View File
@@ -76,7 +76,6 @@ class SupplierImporter extends ItemImporter
$this->item['contact'] = trim($this->findCsvMatch($row, 'contact'));
$this->item['url'] = trim($this->findCsvMatch($row, 'url'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
$this->item['tag_color'] = trim($this->findCsvMatch($row, 'tag_color'));
Log::debug('Item array is: ');
+3 -13
View File
@@ -33,7 +33,6 @@ use App\Notifications\CheckoutConsumableNotification;
use App\Notifications\CheckoutLicenseSeatNotification;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Context;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use Exception;
@@ -129,7 +128,7 @@ class CheckoutableListener
->notify($this->getCheckoutNotification($event, $acceptance));
}
} catch (ClientException $e) {
$status = $e->getResponse()->getStatusCode();
$status = optional($e->getResponse()->getStatusCode());
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
Log::warning(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage());
@@ -232,7 +231,7 @@ class CheckoutableListener
->notify($this->getCheckinNotification($event));
}
} catch (ClientException $e) {
$status = $e->getResponse()->getStatusCode();
$status = optional($e->getResponse()->getStatusCode());
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
Log::warning(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage());
@@ -442,17 +441,12 @@ class CheckoutableListener
private function shouldSendCheckoutEmailToUser(Model $checkoutable): bool
{
/**
* Send an email if we didn't get here from a bulk checkout
* and any of the following conditions are met:
* Send an email if any of the following conditions are met:
* 1. The asset requires acceptance
* 2. The item has a EULA
* 3. The item should send an email at check-in/check-out
*/
if (Context::get('action') === 'bulk_asset_checkout') {
return false;
}
if ($checkoutable->requireAcceptance()) {
return true;
}
@@ -470,10 +464,6 @@ class CheckoutableListener
private function shouldSendEmailToAlertAddress($acceptance = null): bool
{
if (Context::get('action') === 'bulk_asset_checkout') {
return false;
}
$setting = Setting::getSettings();
if (!$setting) {
@@ -1,154 +0,0 @@
<?php
namespace App\Listeners;
use App\Events\CheckoutablesCheckedOutInBulk;
use App\Mail\BulkAssetCheckoutMail;
use App\Models\Asset;
use App\Models\Location;
use App\Models\Setting;
use App\Models\User;
use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
class CheckoutablesCheckedOutInBulkListener
{
public function subscribe($events)
{
$events->listen(
CheckoutablesCheckedOutInBulk::class,
CheckoutablesCheckedOutInBulkListener::class
);
}
public function handle(CheckoutablesCheckedOutInBulk $event): void
{
$notifiableUser = $this->getNotifiableUser($event);
$shouldSendEmailToUser = $this->shouldSendCheckoutEmailToUser($notifiableUser, $event->assets);
$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress($event->assets);
if ($shouldSendEmailToUser && $notifiableUser) {
try {
Mail::to($notifiableUser)->send(new BulkAssetCheckoutMail(
$event->assets,
$event->target,
$event->admin,
$event->checkout_at,
$event->expected_checkin,
$event->note,
));
Log::info('BulkAssetCheckoutMail sent to checkout target');
} catch (Exception $e) {
Log::debug("Exception caught during BulkAssetCheckoutMail to target: " . $e->getMessage());
}
}
if ($shouldSendEmailToAlertAddress && Setting::getSettings()->admin_cc_email) {
try {
Mail::to(Setting::getSettings()->admin_cc_email)->send(new BulkAssetCheckoutMail(
$event->assets,
$event->target,
$event->admin,
$event->checkout_at,
$event->expected_checkin,
$event->note,
));
Log::info('BulkAssetCheckoutMail sent to admin_cc_email');
} catch (Exception $e) {
Log::debug("Exception caught during BulkAssetCheckoutMail to admin_cc_email: " . $e->getMessage());
}
}
}
private function shouldSendCheckoutEmailToUser(?User $user, Collection $assets): bool
{
if (!$user?->email) {
return false;
}
if ($this->hasAssetWithEula($assets)) {
return true;
}
if ($this->hasAssetWithCategorySettingToSendEmail($assets)) {
return true;
}
return $this->hasAssetThatRequiresAcceptance($assets);
}
private function shouldSendEmailToAlertAddress(Collection $assets): bool
{
$setting = Setting::getSettings();
if (!$setting) {
return false;
}
if ($setting->admin_cc_always) {
return true;
}
if (!$this->hasAssetThatRequiresAcceptance($assets)) {
return false;
}
return (bool) $setting->admin_cc_email;
}
private function hasAssetWithEula(Collection $assets): bool
{
foreach ($assets as $asset) {
if ($asset->getEula()) {
return true;
}
}
return false;
}
private function hasAssetWithCategorySettingToSendEmail(Collection $assets): bool
{
foreach ($assets as $asset) {
if ($asset->checkin_email()) {
return true;
}
}
return false;
}
private function hasAssetThatRequiresAcceptance(Collection $assets): bool
{
foreach ($assets as $asset) {
if ($asset->requireAcceptance()) {
return true;
}
}
return false;
}
private function getNotifiableUser(CheckoutablesCheckedOutInBulk $event): ?Model
{
$target = $event->target;
if ($target instanceof Asset) {
$target->load('assignedTo');
return $target->assignedto;
}
if ($target instanceof Location) {
return $target->manager;
}
return $target;
}
}
+17 -41
View File
@@ -150,15 +150,10 @@ class Importer extends Component
// if you got here, we didn't find a match. Try the $aliases_fields
foreach ($this->aliases_fields as $key => $alias_values) {
foreach ($alias_values as $alias_value) {
// Trim off any trailing spaces
$key = trim($key);
$header = trim($header);
if (strcasecmp($alias_value, $header) === 0) { // aLsO CaSe-INSENSitiVE!
// Make *absolutely* sure that this key actually _exists_ in this import type -
// you can trigger this by importing accessories with a 'Warranty' column (which don't exist
// in "Accessories"!)
if (array_key_exists($key, $this->columnOptions[$type])) {
$this->field_map[$i] = $key;
continue 3; // bust out of both of these loops and the surrounding one - e.g. move on to the next header
@@ -267,7 +262,7 @@ class Importer extends Component
'order_number' => trans('general.order_number'),
'purchase_cost' => trans('general.purchase_cost'),
'purchase_date' => trans('general.purchase_date'),
'qty' => trans('general.qty'),
'quantity' => trans('general.qty'),
'supplier' => trans('general.supplier'),
];
@@ -283,7 +278,7 @@ class Importer extends Component
'order_number' => trans('general.order_number'),
'purchase_cost' => trans('general.purchase_cost'),
'purchase_date' => trans('general.purchase_date'),
'qty' => trans('general.qty'),
'quantity' => trans('general.qty'),
'serial' => trans('general.serial_number'),
'supplier' => trans('general.supplier'),
];
@@ -377,14 +372,12 @@ class Importer extends Component
'city' => trans('general.city'),
'notes' => trans('general.notes'),
'state' => trans('general.state'),
'country' => trans('general.country'),
'zip' => trans('general.zip'),
'phone' => trans('general.phone'),
'fax' => trans('general.fax'),
'url' => trans('general.url'),
'contact' => trans('general.contact'),
'email' => trans('general.email'),
'tag_color' => trans('general.tag_color'),
];
$this->manufacturers_fields = [
@@ -396,7 +389,6 @@ class Importer extends Component
'support_email' => trans('admin/manufacturers/table.support_email'),
'warranty_lookup_url' => trans('admin/manufacturers/table.warranty_lookup_url'),
'url' => trans('general.url'),
'tag_color' => trans('general.tag_color'),
];
$this->categories_fields = [
@@ -408,8 +400,6 @@ class Importer extends Component
'use_default_eula' => trans('admin/categories/general.use_default_eula_column'),
'require_acceptance' => trans('admin/categories/general.import_require_acceptance'),
'checkin_email' => trans('admin/categories/general.import_checkin_email'),
'alert_on_response' => trans('admin/categories/general.import_alert_on_response'),
'tag_color' => trans('general.tag_color'),
];
@@ -419,25 +409,16 @@ class Importer extends Component
'category' => trans('general.category'),
'eol' => trans('general.eol'),
'fieldset' => trans('admin/models/general.fieldset'),
'name' => trans('general.name'),
'name' => trans('general.item_name_var', ['item' => trans('general.asset_model')]),
'manufacturer' => trans('general.manufacturer'),
'min_amt' => trans('mail.min_QTY'),
'model_number' => trans('general.model_no'),
'notes' => trans('general.notes'),
'requestable' => trans('general.requestable'),
'notes' => trans('general.item_notes', ['item' => trans('admin/hardware/form.model')]),
'requestable' => trans('admin/models/general.requestable'),
'require_serial' => trans('admin/hardware/general.require_serial'),
'tag_color' => trans('general.tag_color'),
'depreciation' => trans('general.depreciation'),
];
/**
* These are the "real fieldnames" with a list of possible aliases,
* like misspellings, slight mis-phrasings, user-specific language, etc. that
* could be in the imported file header.
* This just makes the user's experience a little better when they're using
* their own CSV template.
*/
// "real fieldnames" to a list of aliases for that field
$this->aliases_fields = [
'item_name' =>
[
@@ -458,20 +439,6 @@ class Importer extends Component
'item no.',
'item #',
],
'order_number' => [
'order #',
'order no.',
'order num',
'order number',
'order',
],
'eula_text' => [
'eula',
],
'checkin_email' => [
'checkin email',
],
'asset_model' =>
[
'model name',
@@ -489,6 +456,16 @@ class Importer extends Component
'EOL',
'eol months',
],
'depreciation' =>
[
'Depreciation',
'depreciation',
],
'requestable' =>
[
'requestable',
'Requestable',
],
'gravatar' =>
[
'gravatar',
@@ -565,8 +542,7 @@ class Importer extends Component
],
'require_serial' =>
[
trans('admin/models/general.importer.require_serial'),
trans('admin/models/general.importer.serial_reqiured'),
'serial required',
],
'model_number' =>
[
+1 -1
View File
@@ -84,7 +84,7 @@ class OauthClients extends Component
]);
$client = app(ClientRepository::class)->find($editClientId->id);
if ($client->user_id == auth()->id()) {
if ($client->created_by == auth()->id()) {
$client->name = $this->editName;
$client->redirect = $this->editRedirect;
$client->save();
-165
View File
@@ -1,165 +0,0 @@
<?php
namespace App\Mail;
use App\Models\Asset;
use App\Models\CustomField;
use App\Models\Location;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
class BulkAssetCheckoutMail extends Mailable
{
use Queueable, SerializesModels;
public bool $requires_acceptance;
public Collection $assetsByCategory;
public function __construct(
public Collection $assets,
public Model $target,
public User $admin,
public string $checkout_at,
public string $expected_checkin,
public string $note,
) {
$this->requires_acceptance = $this->requiresAcceptance();
$this->loadCustomFieldsOnAssets();
$this->loadEulasOnAssets();
$this->assetsByCategory = $this->groupAssetsByCategory();
}
public function envelope(): Envelope
{
return new Envelope(
subject: $this->getSubject(),
);
}
public function content(): Content
{
return new Content(
markdown: 'mail.markdown.bulk-asset-checkout-mail',
with: [
'introduction' => $this->getIntroduction(),
'requires_acceptance' => $this->requires_acceptance,
'requires_acceptance_info' => $this->getRequiresAcceptanceInfo(),
'requires_acceptance_prompt' => $this->getRequiresAcceptancePrompt(),
'singular_eula' => $this->getSingularEula(),
],
);
}
public function attachments(): array
{
return [];
}
private function getSubject(): string
{
if ($this->assets->count() > 1) {
return ucfirst(trans('general.assets_checked_out_count'));
}
return trans('mail.Asset_Checkout_Notification', ['tag' => $this->assets->first()->asset_tag]);
}
private function loadCustomFieldsOnAssets(): void
{
$this->assets = $this->assets->map(function (Asset $asset) {
$fields = $asset->model?->fieldset?->fields->filter(function (CustomField $field) {
return $field->show_in_email && !$field->field_encrypted;
});
$asset->setRelation('fields', $fields);
return $asset;
});
}
private function loadEulasOnAssets(): void
{
$this->assets = $this->assets->map(function (Asset $asset) {
$asset->eula = $asset->getEula();
return $asset;
});
}
private function groupAssetsByCategory(): Collection
{
return $this->assets->groupBy(fn($asset) => $asset->model->category->id);
}
private function getIntroduction(): string
{
if ($this->target instanceof Location) {
return trans_choice('mail.new_item_checked_location', $this->assets->count(), ['location' => $this->target->name]);
}
return trans_choice('mail.new_item_checked', $this->assets->count());
}
private function getRequiresAcceptanceInfo(): ?string
{
if (!$this->requires_acceptance) {
return null;
}
return trans_choice('mail.items_checked_out_require_acceptance', $this->assets->count());
}
private function getRequiresAcceptancePrompt(): ?string
{
if (!$this->requires_acceptance) {
return null;
}
$acceptanceUrl = $this->assets->count() === 1
? route('account.accept.item', $this->assets->first())
: route('account.accept');
return
sprintf(
'**[✔ %s](%s)**',
trans_choice('mail.click_here_to_review_terms_and_accept_item', $this->assets->count()),
$acceptanceUrl,
);
}
private function getSingularEula()
{
// get unique categories from all assets
$categories = $this->assets->pluck('model.category.id')->unique();
// if assets do not have the same category then return early...
if ($categories->count() > 1) {
return null;
}
// if assets do have the same category then return the shared EULA
if ($categories->count() === 1) {
return $this->assets->first()->getEula();
}
}
private function requiresAcceptance(): bool
{
foreach ($this->assets as $asset) {
if ($asset->requireAcceptance()) {
return true;
}
}
return false;
}
}
+2 -1
View File
@@ -12,6 +12,7 @@ use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\SerializesModels;
class CheckoutAssetMail extends BaseMailable
@@ -24,7 +25,7 @@ class CheckoutAssetMail extends BaseMailable
* Create a new message instance.
* @throws \Exception
*/
public function __construct(Asset $asset, $checkedOutTo, ?User $checkedOutBy, $acceptance, $note, bool $firstTimeSending = true)
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note, bool $firstTimeSending = true)
{
$this->item = $asset;
$this->admin = $checkedOutBy;
+9 -13
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Helpers\Helper;
use App\Models\Traits\Acceptable;
use App\Models\Traits\CompanyableTrait;
use App\Models\Traits\HasUploads;
@@ -20,23 +21,21 @@ use Watson\Validating\ValidatingTrait;
*/
class Accessory extends SnipeModel
{
use Acceptable;
use CompanyableTrait;
use HasFactory;
protected $presenter = \App\Presenters\AccessoryPresenter::class;
use CompanyableTrait;
use HasUploads;
use Loggable;
use Presentable;
use Searchable;
use Loggable, Presentable;
use SoftDeletes;
use ValidatingTrait;
protected $table = 'accessories';
protected $casts = [
'purchase_date' => 'datetime',
'requestable' => 'boolean', ];
protected $presenter = \App\Presenters\AccessoryPresenter::class;
use Searchable;
use Acceptable;
/**
* The attributes that should be included when searching the model.
@@ -81,7 +80,7 @@ class Accessory extends SnipeModel
* @var bool
*/
protected $injectUniqueIdentifier = true;
use ValidatingTrait;
/**
* The attributes that are mass assignable.
@@ -120,9 +119,6 @@ class Accessory extends SnipeModel
}
public function isDeletable() {
return $this->checkouts_count === 0;
}
/**
* Sets the requestable attribute on the accessory
*
@@ -272,7 +268,7 @@ class Accessory extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -1
View File
@@ -58,7 +58,7 @@ class AccessoryCheckout extends Model
*/
public function adminuser()
{
return $this->belongsTo(User::class, 'created_by')->withTrashed();
return $this->belongsTo(User::class, 'created_by');
}
/**
+1 -3
View File
@@ -907,7 +907,7 @@ class Asset extends Depreciable
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
@@ -1271,7 +1271,6 @@ class Asset extends Depreciable
$query = $query
->orWhere('assets_users.first_name', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.last_name', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.display_name', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.jobtitle', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.username', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.employee_num', 'LIKE', '%'.$term.'%')
@@ -1916,7 +1915,6 @@ class Asset extends Depreciable
function ($query) use ($search_val) {
$query->where('users.first_name', 'LIKE', '%'.$search_val.'%')
->orWhere('users.last_name', 'LIKE', '%'.$search_val.'%')
->orWhere('users.display_name', 'LIKE', '%'.$search_val.'%')
->orWhere('users.username', 'LIKE', '%'.$search_val.'%');
}
);
+1 -1
View File
@@ -234,7 +234,7 @@ class AssetModel extends SnipeModel
public function isDeletable()
{
return Gate::allows('delete', $this)
&& (($this->assets_count ?? $this->assets()->count()) === 0)
&& ($this->assets_count == 0)
&& ($this->deleted_at == '');
}
+1 -1
View File
@@ -242,7 +242,7 @@ class Category extends SnipeModel
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -1
View File
@@ -46,7 +46,7 @@ class Checkoutable
$category = optional($unaccepted_row->license?->category?->present())->nameUrl() ?? '';
$company = optional($unaccepted_row->license?->company?->present())?->nameUrl() ?? '';
$model = '';
$name = $unaccepted_row->license?->present()->nameUrl() ?? '';
$name = $unaccepted_row->license->present()->nameUrl() ?? '';
}
if($unaccepted_row instanceof Consumable){
$category = optional($unaccepted_row->category?->present())->nameUrl() ?? '';
+1 -1
View File
@@ -320,7 +320,7 @@ final class Company extends SnipeModel
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
+5 -12
View File
@@ -167,7 +167,7 @@ class Component extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
@@ -264,21 +264,14 @@ class Component extends SnipeModel
// In case there are elements checked out to assets that belong to a different company
// than this asset and full multiple company support is on we'll remove the global scope,
// so they are included in the count.
// the 'sum' query returns NULL when there are zero checkouts - which can inadvertently re-trigger the following query
// for un-checked-out components. So we have to do this very careful process of fetching the 'attributes'
// of the component, then see if sum_unconstrained_assets exists as an attribute. If it doesn't, we run the
// query. But if it *does* exist as an attribute - even a null - we skip the query, because that means that this
// component was fetched using withCount() - and that count *is* accurate, even if null. We just do a quick
// null-coalesce at the end to zero for the null case.
$raw_attributes = $this->getAttributes();
if (!array_key_exists('sum_unconstrained_assets', $raw_attributes) || $recalculate) {
// This part should *only* run if the component was fetched *without* withCount() (or you've asked to recalculate)
if (is_null($this->sum_unconstrained_assets) || $recalculate) {
// This, in a components-listing context, is mostly important for when it sets a 'zero' which
// is *not* null - so we don't have to keep recalculating for un-checked-out components
// NOTE: doing this will add a 'pseudo-attribute' to the component in question, so we need to _remove_ this
// before we save - so that gets handled in the 'saving' callback defined in the 'booted' method, above.
$this->sum_unconstrained_assets = $this->unconstrainedAssets()->sum('assigned_qty') ?? 0;
}
return $this->sum_unconstrained_assets ?? 0;
return $this->sum_unconstrained_assets;
}
+1 -9
View File
@@ -13,7 +13,6 @@ use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Storage;
use Watson\Validating\ValidatingTrait;
@@ -132,13 +131,6 @@ class Consumable extends SnipeModel
$this->attributes['requestable'] = filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
public function isDeletable()
{
return Gate::allows('delete', $this)
&& ($this->numCheckedOut() === 0)
&& ($this->deleted_at == '');
}
/**
* Establishes the consumable -> admin user relationship
*
@@ -148,7 +140,7 @@ class Consumable extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(User::class, 'created_by')->withTrashed();
return $this->belongsTo(User::class, 'created_by');
}
/**
+1 -1
View File
@@ -29,6 +29,6 @@ class ConsumableAssignment extends Model
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
}
-8
View File
@@ -7,7 +7,6 @@ use App\Models\Traits\CompanyableTrait;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Gate;
use Watson\Validating\ValidatingTrait;
class Department extends SnipeModel
@@ -78,13 +77,6 @@ class Department extends SnipeModel
*/
protected $searchableRelations = [];
public function isDeletable()
{
return Gate::allows('delete', $this) && (($this->users_count ?? $this->users()->count()) === 0);
}
/**
* Establishes the department -> company relationship
*
+1 -1
View File
@@ -108,7 +108,7 @@ class Depreciation extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
+1 -1
View File
@@ -68,7 +68,7 @@ class Group extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -1
View File
@@ -24,6 +24,6 @@ class Import extends Model
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
}
+2 -2
View File
@@ -195,7 +195,7 @@ class Ldap extends Model
$connection = self::connectToLdap();
$ldap_username_field = $settings->ldap_username_field;
$baseDn = $settings->ldap_basedn;
$userDn = $ldap_username_field . '=' . ldap_escape($username, '', LDAP_ESCAPE_DN) . ',' . $settings->ldap_basedn;
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
if ($settings->is_ad == '1') {
// Check if they are using the userprincipalname for the username field.
@@ -213,7 +213,7 @@ class Ldap extends Model
}
}
$filterQuery = $settings->ldap_auth_filter_query . ldap_escape($username, '', LDAP_ESCAPE_FILTER);
$filterQuery = $settings->ldap_auth_filter_query.$username;
$filter = Setting::getSettings()->ldap_filter; //FIXME - this *does* respect the ldap filter, but I believe that AdLdap2 did *not*.
$filterQuery = "({$filter}({$filterQuery}))";
+3 -29
View File
@@ -13,7 +13,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Session;
use Watson\Validating\ValidatingTrait;
@@ -159,14 +158,6 @@ class License extends Depreciable
);
}
public function isDeletable()
{
return Gate::allows('delete', $this)
&& ($this->free_seats_count == $this->seats)
&& ($this->deleted_at == '');
}
protected function terminatesFormattedDate(): Attribute
{
@@ -398,7 +389,7 @@ class License extends Depreciable
*/
public function category()
{
return $this->belongsTo(\App\Models\Category::class, 'category_id')->withTrashed();
return $this->belongsTo(\App\Models\Category::class, 'category_id');
}
/**
@@ -410,7 +401,7 @@ class License extends Depreciable
*/
public function manufacturer()
{
return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id')->withTrashed();
return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id');
}
/**
@@ -487,7 +478,7 @@ class License extends Depreciable
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
@@ -591,23 +582,6 @@ class License extends Depreciable
->whereNull('deleted_at');
}
/**
* This is really dumb - needs to be refactored, since we have ~3 diff methods that do almost the same thing
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v2.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function numRemaining()
{
return $this->licenseSeatsRelation()
->whereNull('asset_id')
->whereNull('assigned_to')
->where('unreassignable_seat', '=', false)
->whereNull('deleted_at')
->count();
}
/**
* Sets the available seats attribute
*
+1 -1
View File
@@ -69,7 +69,7 @@ class LicenseSeat extends SnipeModel implements ICompanyableChild
protected function name(): Attribute
{
return Attribute:: make(
get: fn(mixed $value) => $this->license?->name,
get: fn(mixed $value) => $this->license->name,
);
}
+10 -24
View File
@@ -15,18 +15,14 @@ use Watson\Validating\ValidatingTrait;
class Location extends SnipeModel
{
use CompanyableTrait;
use HasFactory;
use HasUploads;
use CompanyableTrait;
use Loggable;
use Presentable;
use Searchable;
use SoftDeletes;
use UniqueUndeletedTrait;
use ValidatingTrait;
protected $presenter = \App\Presenters\LocationPresenter::class;
use Presentable;
use SoftDeletes;
use HasUploads;
protected $table = 'locations';
protected $rules = [
@@ -57,7 +53,8 @@ class Location extends SnipeModel
* @var bool
*/
protected $injectUniqueIdentifier = true;
use ValidatingTrait;
use UniqueUndeletedTrait;
/**
* The attributes that are mass assignable.
@@ -83,28 +80,16 @@ class Location extends SnipeModel
'tag_color',
'notes',
];
protected $hidden = ['user_id'];
use Searchable;
/**
* The attributes that should be included when searching the model.
*
* @var array
*/
protected $searchableAttributes =
[
'name',
'address',
'city',
'state',
'zip',
'created_at',
'ldap_ou',
'phone',
'fax',
'notes'
];
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou', 'phone', 'fax', 'notes'];
/**
* The relations and their attributes that should be included when searching the model.
@@ -129,6 +114,7 @@ class Location extends SnipeModel
*/
public function isDeletable()
{
return Gate::allows('delete', $this)
&& ($this->deleted_at == '')
&& (($this->assets_count ?? $this->assets()->count()) === 0)
@@ -163,7 +149,7 @@ class Location extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -23
View File
@@ -10,9 +10,7 @@ use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Gate;
use Watson\Validating\ValidatingTrait;
use App\Presenters\MaintenancesPresenter;
/**
* Model for Asset Maintenances.
@@ -29,7 +27,7 @@ class Maintenance extends SnipeModel implements ICompanyableChild
use Loggable, Presentable;
protected $presenter = MaintenancesPresenter::class;
protected $table = 'maintenances';
protected $rules = [
'asset_id' => 'required|integer',
@@ -120,12 +118,6 @@ class Maintenance extends SnipeModel implements ICompanyableChild
];
}
public function isDeletable()
{
return Gate::allows('delete', $this);
}
public function setIsWarrantyAttribute($value)
{
if ($value == '') {
@@ -323,18 +315,4 @@ class Maintenance extends SnipeModel implements ICompanyableChild
{
return $query->leftJoin('users as admin_sort', 'maintenances.created_by', '=', 'admin_sort.id')->select('maintenances.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
}
public function scopeOrderByAssetModelName($query, $order)
{
return $query->join('assets as maintained_asset', 'maintenances.asset_id', '=', 'maintained_asset.id')
->leftjoin('models as maintained_asset_model', 'maintained_asset_model.id', '=', 'maintained_asset.model_id')
->orderBy('maintained_asset_model.name', $order);
}
public function scopeOrderByAssetModelNumber($query, $order)
{
return $query->join('assets as maintained_asset', 'maintenances.asset_id', '=', 'maintained_asset.id')
->leftjoin('models as maintained_asset_model', 'maintained_asset_model.id', '=', 'maintained_asset.model_id')
->orderBy('maintained_asset_model.model_number', $order);
}
}
+1 -1
View File
@@ -116,7 +116,7 @@ class Manufacturer extends SnipeModel
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
+2 -14
View File
@@ -2,7 +2,6 @@
namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -14,47 +13,36 @@ class ReportTemplate extends Model
{
use HasFactory;
use SoftDeletes;
use UniqueUndeletedTrait;
use ValidatingTrait;
protected $table = 'report_templates';
protected $casts = [
'options' => 'array',
'is_shared' => 'boolean',
];
protected $fillable = [
'created_by',
'name',
'options',
'is_shared',
];
protected $rules = [
'name' => [
'required',
'string',
'unique_undeleted:report_templates,name',
],
'options' => [
'required',
'array',
],
'is_shared' => [
'boolean',
],
];
protected static function booted()
{
// Scope to current user or if template is shared
// Scope to current user
static::addGlobalScope(
'current_user', function (Builder $builder) {
if (auth()->check()) {
$builder->where('created_by', auth()->id())
->orWhere('is_shared', 1);
$builder->where('created_by', auth()->id());
}
}
);
+1 -14
View File
@@ -4,27 +4,21 @@ namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Gate;
use Watson\Validating\ValidatingTrait;
class Statuslabel extends SnipeModel
{
use HasFactory;
use SoftDeletes;
use ValidatingTrait;
use UniqueUndeletedTrait;
use Presentable;
protected $injectUniqueIdentifier = true;
protected $table = 'status_labels';
protected $hidden = ['user_id', 'deleted_at'];
protected $presenter = \App\Presenters\StatusLabelPresenter::class;
protected $rules = [
'name' => 'required|max:255|string|unique_undeleted',
@@ -58,13 +52,6 @@ class Statuslabel extends SnipeModel
*/
protected $searchableRelations = [];
public function isDeletable()
{
return Gate::allows('delete', $this)
&& (($this->assets_count ?? $this->assets()->count()) === 0)
&& ($this->deleted_at == '');
}
/**
* Establishes the status label -> assets relationship
*
@@ -79,7 +66,7 @@ class Statuslabel extends SnipeModel
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -1
View File
@@ -158,7 +158,7 @@ class Supplier extends SnipeModel
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
+1 -1
View File
@@ -20,7 +20,7 @@ trait CompanyableTrait
if (__CLASS__ != 'App\Models\Location') {
static::addGlobalScope(new CompanyableScope);
} else {
if (Setting::getSettings()?->scope_locations_fmcs == 1) {
if (Setting::getSettings()->scope_locations_fmcs == 1) {
static::addGlobalScope(new CompanyableScope);
}
}
-86
View File
@@ -1,86 +0,0 @@
<?php
namespace App\Observers;
use App\Models\Actionlog;
use App\Models\Location;
class LocationObserver
{
/**
* Listen to the User created event.
*
* @param Location $location
* @return void
*/
public function updating(Location $location)
{
$changed = [];
foreach ($location->getRawOriginal() as $key => $value) {
// Check and see if the value changed
if ($location->getRawOriginal()[$key] != $location->getAttributes()[$key]) {
$changed[$key]['old'] = $location->getRawOriginal()[$key];
$changed[$key]['new'] = $location->getAttributes()[$key];
}
}
if (count($changed) > 0) {
$logAction = new Actionlog();
$logAction->item_type = Location::class;
$logAction->item_id = $location->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
}
}
/**
* Listen to the Location created event when
* a new location is created.
*
* @param Location $location
* @return void
*/
public function created(Location $location)
{
$logAction = new Actionlog();
$logAction->item_type = Location::class;
$logAction->item_id = $location->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
if($location->imported) {
$logAction->setActionSource('importer');
}
$logAction->logaction('create');
}
/**
* Listen to the Location deleting event.
*
* @param Location $location
* @return void
*/
public function deleting(Location $location)
{
$logAction = new Actionlog();
$logAction->item_type = Location::class;
$logAction->item_id = $location->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('delete');
}
public function restoring(Location $location)
{
$logAction = new Actionlog();
$logAction->item_type = Location::class;
$logAction->item_id = $location->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('restore');
}
}
-2
View File
@@ -181,7 +181,6 @@ class AccessoryPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'accessoriesActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
@@ -251,7 +250,6 @@ class AccessoryPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'accessoriesInOutFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-1
View File
@@ -268,7 +268,6 @@ class AssetAuditPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'hardwareAuditFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
return json_encode($layout);
+3 -5
View File
@@ -17,7 +17,6 @@ class AssetModelPresenter extends Presenter
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print',
],
[
'field' => 'id',
@@ -215,7 +214,6 @@ class AssetModelPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'modelsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
return json_encode($layout);
@@ -306,10 +304,10 @@ class AssetModelPresenter extends Presenter
public function formattedNameLink() {
if (auth()->user()->can('view', ['\App\Models\AssetModel', $this])) {
return '<a href="'.route('models.show', e($this->id)).'" class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</a>';
if (auth()->user()->can('models.view', $this)) {
return '<a href="'.route('models.show', e($this->id)).'">'.e($this->name).'</a>';
}
return '<span class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
return $this->name;
}
}
+7 -11
View File
@@ -23,7 +23,6 @@ class AssetPresenter extends Presenter
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print'
], [
'field' => 'id',
'searchable' => false,
@@ -152,15 +151,14 @@ class AssetPresenter extends Presenter
'visible' => false,
'title' => trans('general.purchase_date'),
'formatter' => 'dateDisplayFormatter',
], [
'field' => 'first_checkout',
'searchable' => true,
'sortable' => true,
'visible' => false,
'title' => trans('general.first_checkout'),
'formatter' => 'dateDisplayFormatter',
],
// [
// 'field' => 'first_checkout',
// 'searchable' => true,
// 'sortable' => true,
// 'visible' => false,
// 'title' => trans('general.first_checkout'),
// 'formatter' => 'dateDisplayFormatter',
// ],
[
'field' => 'age',
'searchable' => false,
@@ -359,7 +357,6 @@ class AssetPresenter extends Presenter
'visible' => true,
'formatter' => 'hardwareInOutFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
$layout[] = [
@@ -370,7 +367,6 @@ class AssetPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'hardwareActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
return json_encode($layout);
+3 -12
View File
@@ -18,8 +18,6 @@ class CategoryPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print',
],
[
'field' => 'id',
@@ -129,7 +127,6 @@ class CategoryPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'categoriesActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
@@ -160,16 +157,10 @@ class CategoryPresenter extends Presenter
public function formattedNameLink() {
// We use soft-deletes for categories, but we don't give you a way to restore them right now. This would be the method we'd use when that happens
// if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
// return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('models.show', e($this->id)).'" class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</a>';
// }
if ((auth()->user()->can('view', ['\App\Models\Category', $this])) && ($this->deleted_at=='')) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
}
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<span class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').e($this->name);
}
}
-1
View File
@@ -152,7 +152,6 @@ class CompanyPresenter extends Presenter
'visible' => true,
'formatter' => 'companiesActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-59
View File
@@ -186,65 +186,6 @@ class ComponentPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'componentsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
return json_encode($layout);
}
public static function checkedOut() {
$layout = [
[
'field' => 'id',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => trans('general.id'),
'visible' => false,
],
[
'field' => 'name',
'searchable' => true,
'sortable' => true,
'title' => trans('general.name'),
'visible' => true,
'formatter' => 'hardwareLinkFormatter',
],
[
'field' => 'qty',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.qty'),
'visible' => true,
],
[
'field' => 'note',
'searchable' => true,
'sortable' => true,
'visible' => true,
'title' => trans('general.notes'),
'formatter' => 'notesFormatter',
],[
'field' => 'created_at',
'searchable' => false,
'sortable' => true,
'visible' => false,
'title' => trans('general.created_at'),
'formatter' => 'dateDisplayFormatter',
],
$layout[] = [
'field' => 'available_actions',
'searchable' => false,
'sortable' => false,
'switchable' => false,
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'componentsInOutFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
return json_encode($layout);
-53
View File
@@ -181,65 +181,12 @@ class ConsumablePresenter extends Presenter
'visible' => true,
'formatter' => 'consumablesActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
return json_encode($layout);
}
public static function checkedOut()
{
$layout = [
[
'field' => 'avatar',
'searchable' => false,
'sortable' => false,
'title' => trans('general.image'),
'visible' => true,
'formatter' => 'imageFormatter',
],
[
'field' => 'user',
'searchable' => false,
'sortable' => false,
'title' => trans('general.name'),
'visible' => true,
'formatter' => 'usersLinkObjFormatter',
],
[
'field' => 'created_at',
'searchable' => false,
'sortable' => false,
'title' => trans('general.date'),
'visible' => true,
'formatter' => 'dateDisplayFormatter',
],
[
'field' => 'note',
'searchable' => false,
'sortable' => false,
'title' => trans('general.notes'),
'visible' => true,
],
[
'field' => 'created_by',
'searchable' => false,
'sortable' => false,
'title' => trans('general.created_by'),
'visible' => true,
'formatter' => 'usersLinkObjFormatter',
],
];
return json_encode($layout);
}
/**
* Url to view this item.
* @return string
-1
View File
@@ -111,7 +111,6 @@ class DepartmentPresenter extends Presenter
'visible' => true,
'formatter' => 'departmentsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-1
View File
@@ -97,7 +97,6 @@ class DepreciationPresenter extends Presenter
'visible' => true,
'formatter' => 'depreciationsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-1
View File
@@ -69,7 +69,6 @@ class GroupPresenter extends Presenter
'visible' => true,
'formatter' => 'groupsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-3
View File
@@ -213,7 +213,6 @@ class LicensePresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'licensesActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
];
return json_encode($layout);
@@ -308,8 +307,6 @@ class LicensePresenter extends Presenter
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'licenseSeatInOutFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-4
View File
@@ -20,7 +20,6 @@ class LocationPresenter extends Presenter
'formatter' => 'checkboxEnabledFormatter',
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print',
], [
'field' => 'id',
'searchable' => false,
@@ -267,8 +266,6 @@ class LocationPresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'locationsActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
@@ -337,7 +334,6 @@ class LocationPresenter extends Presenter
'title' => trans('table.actions'),
'formatter' => 'accessoriesInOutFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-8
View File
@@ -81,14 +81,6 @@ class MaintenancesPresenter extends Presenter
'visible' => false,
'formatter' => 'modelsLinkObjFormatter',
], [
'field' => 'model.model_number',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.model_no'),
'visible' => true,
],
[
'field' => 'supplier',
'searchable' => true,
'sortable' => true,
-3
View File
@@ -18,8 +18,6 @@ class ManufacturerPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print',
],
[
'field' => 'id',
@@ -170,7 +168,6 @@ class ManufacturerPresenter extends Presenter
'visible' => true,
'formatter' => 'manufacturersActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
-2
View File
@@ -17,8 +17,6 @@ class SupplierPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print'
],
[
'field' => 'id',
@@ -59,8 +59,6 @@ class UploadedFilesPresenter extends Presenter
'title' => trans('general.download'),
'visible' => true,
'formatter' => 'fileDownloadButtonsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
[
'field' => 'note',
@@ -95,7 +93,6 @@ class UploadedFilesPresenter extends Presenter
'visible' => true,
'formatter' => 'deleteUploadFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
+2 -4
View File
@@ -26,7 +26,6 @@ class UserPresenter extends Presenter
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
'class' => 'hidden-print',
],
[
'field' => 'id',
@@ -433,7 +432,6 @@ class UserPresenter extends Presenter
'visible' => true,
'formatter' => 'usersActionsFormatter',
'printIgnore' => true,
'class' => 'hidden-print',
],
];
@@ -553,9 +551,9 @@ class UserPresenter extends Presenter
public function formattedNameLink() {
if (auth()->user()->can('view', ['\App\Models\User', $this])) {
return '<a href="'.route('users.show', e($this->id)).'" class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</a>';
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('users.show', e($this->id)).'">'.e($this->display_name).'</a>';
}
return '<span class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').e($this->display_name);
}
}
+8 -11
View File
@@ -7,25 +7,23 @@ use App\Models\Asset;
use App\Models\Component;
use App\Models\Consumable;
use App\Models\License;
use App\Models\Location;
use App\Models\Maintenance;
use App\Models\User;
use App\Models\Setting;
use App\Models\SnipeSCIMConfig;
use App\Models\User;
use App\Observers\AccessoryObserver;
use App\Observers\AssetObserver;
use App\Observers\UserObserver;
use App\Observers\ComponentObserver;
use App\Observers\ConsumableObserver;
use App\Observers\LicenseObserver;
use App\Observers\LocationObserver;
use App\Observers\MaintenanceObserver;
use App\Observers\SettingObserver;
use App\Observers\UserObserver;
use App\Observers\MaintenanceObserver;
use Illuminate\Routing\UrlGenerator;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
/**
* This service provider handles setting the observers on models
@@ -70,15 +68,14 @@ class AppServiceProvider extends ServiceProvider
\Illuminate\Pagination\Paginator::useBootstrap();
Schema::defaultStringLength(191);
Accessory::observe(AccessoryObserver::class);
Asset::observe(AssetObserver::class);
Maintenance::observe(MaintenanceObserver::class);
User::observe(UserObserver::class);
Accessory::observe(AccessoryObserver::class);
Component::observe(ComponentObserver::class);
Consumable::observe(ConsumableObserver::class);
License::observe(LicenseObserver::class);
Location::observe(LocationObserver::class);
Maintenance::observe(MaintenanceObserver::class);
Setting::observe(SettingObserver::class);
User::observe(UserObserver::class);
}
/**
+2 -10
View File
@@ -214,12 +214,6 @@ class BreadcrumbsServiceProvider extends ServiceProvider
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $component->name]), route('components.edit', $component))
);
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
@@ -268,10 +262,9 @@ class BreadcrumbsServiceProvider extends ServiceProvider
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'))
->push(trans('general.create'), route('fieldsets.create'))
);
Breadcrumbs::for('fieldsets.show', fn (Trail $trail, CustomFieldset $fieldset) =>
$trail->parent('fields.index', route('fields.index'))
->push($fieldset->name, route('fields.index'))
@@ -441,8 +434,7 @@ class BreadcrumbsServiceProvider extends ServiceProvider
Breadcrumbs::for('maintenances.edit', fn (Trail $trail, Maintenance $maintenance) =>
$trail->parent('maintenances.index', route('maintenances.index'))
->push($maintenance->name, route('maintenances.show', $maintenance))
->push(trans('general.update', ['name' => $maintenance->name]), route('maintenances.edit', $maintenance))
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $maintenance->name]), route('maintenances.edit', $maintenance))
);
-2
View File
@@ -3,7 +3,6 @@
namespace App\Providers;
use App\Listeners\CheckoutableListener;
use App\Listeners\CheckoutablesCheckedOutInBulkListener;
use App\Listeners\LogListener;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
@@ -32,6 +31,5 @@ class EventServiceProvider extends ServiceProvider
protected $subscribe = [
LogListener::class,
CheckoutableListener::class,
CheckoutablesCheckedOutInBulkListener::class,
];
}
@@ -85,10 +85,6 @@ class SettingsServiceProvider extends ServiceProvider
return 'models/';
});
app()->singleton('assets_upload_url', function () {
return 'assets/';
});
app()->singleton('licenses_upload_url', function () {
return 'licenses/';
});
@@ -183,10 +179,6 @@ class SettingsServiceProvider extends ServiceProvider
return 'components/';
});
app()->singleton('maintenances_upload_url', function () {
return 'maintenances/';
});
// 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'));
-13
View File
@@ -1,13 +0,0 @@
<?php
namespace App\Traits;
trait DisablesDebugbar
{
public function disableDebugbar()
{
if (class_exists(\Fruitcake\LaravelDebugbar\Facades\Debugbar::class)) {
\Fruitcake\LaravelDebugbar\Facades\Debugbar::disable();
}
}
}
+3 -4
View File
@@ -31,6 +31,7 @@
"alek13/slack": "^2.0",
"arietimmerman/laravel-scim-server": "dev-master",
"bacon/bacon-qr-code": "^2.0",
"barryvdh/laravel-debugbar": "^3.13",
"doctrine/cache": "^1.10",
"doctrine/dbal": "^3.1",
"doctrine/instantiator": "^1.3",
@@ -54,7 +55,7 @@
"laravelcollective/html": "6.x-dev",
"league/csv": "^9.7",
"league/flysystem-aws-s3-v3": "^3.0",
"livewire/livewire": "^4.0",
"livewire/livewire": "^3.5",
"neitanod/forceutf8": "^2.0",
"nesbot/carbon": "^3.0",
"nunomaduro/collision": "^8.1",
@@ -83,7 +84,6 @@
"ext-exif": "*"
},
"require-dev": {
"fruitcake/laravel-debugbar": "^4.0",
"larastan/larastan": "^2.9",
"laravel/telescope": "^5.11",
"mockery/mockery": "^1.4",
@@ -125,8 +125,7 @@
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan vendor:publish --force --tag=livewire:assets --ansi",
"@php fix-permissions.php"
"@php artisan vendor:publish --force --tag=livewire:assets --ansi"
],
"post-create-project-cmd": [
"php artisan key:generate"
Generated
+209 -321
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "58603818d33285d78c0c8655385e7c0e",
"content-hash": "b1dfc90a20cecf851224ea8a5c71f26d",
"packages": [
{
"name": "alek13/slack",
@@ -340,6 +340,91 @@
},
"time": "2022-12-07T17:46:57+00:00"
},
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.16.0",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "f265cf5e38577d42311f1a90d619bcd3740bea23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/f265cf5e38577d42311f1a90d619bcd3740bea23",
"reference": "f265cf5e38577d42311f1a90d619bcd3740bea23",
"shasum": ""
},
"require": {
"illuminate/routing": "^9|^10|^11|^12",
"illuminate/session": "^9|^10|^11|^12",
"illuminate/support": "^9|^10|^11|^12",
"php": "^8.1",
"php-debugbar/php-debugbar": "~2.2.0",
"symfony/finder": "^6|^7"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"orchestra/testbench-dusk": "^7|^8|^9|^10",
"phpunit/phpunit": "^9.5.10|^10|^11",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
},
"providers": [
"Barryvdh\\Debugbar\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.16-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Barryvdh\\Debugbar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "PHP Debugbar integration for Laravel",
"keywords": [
"debug",
"debugbar",
"dev",
"laravel",
"profiler",
"webprofiler"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.0"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2025-07-14T11:56:43+00:00"
},
{
"name": "brick/math",
"version": "0.14.0",
@@ -4373,16 +4458,16 @@
},
{
"name": "livewire/livewire",
"version": "v4.1.4",
"version": "v3.6.4",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "4697085e02a1f5f11410a1b5962400e3539f8843"
"reference": "ef04be759da41b14d2d129e670533180a44987dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/4697085e02a1f5f11410a1b5962400e3539f8843",
"reference": "4697085e02a1f5f11410a1b5962400e3539f8843",
"url": "https://api.github.com/repos/livewire/livewire/zipball/ef04be759da41b14d2d129e670533180a44987dc",
"reference": "ef04be759da41b14d2d129e670533180a44987dc",
"shasum": ""
},
"require": {
@@ -4437,7 +4522,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v4.1.4"
"source": "https://github.com/livewire/livewire/tree/v3.6.4"
},
"funding": [
{
@@ -4445,7 +4530,7 @@
"type": "github"
}
],
"time": "2026-02-09T22:59:54+00:00"
"time": "2025-07-17T05:12:15+00:00"
},
{
"name": "masterminds/html5",
@@ -5755,6 +5840,79 @@
},
"time": "2025-12-30T16:16:35+00:00"
},
{
"name": "php-debugbar/php-debugbar",
"version": "v2.2.4",
"source": {
"type": "git",
"url": "https://github.com/php-debugbar/php-debugbar.git",
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/3146d04671f51f69ffec2a4207ac3bdcf13a9f35",
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35",
"shasum": ""
},
"require": {
"php": "^8",
"psr/log": "^1|^2|^3",
"symfony/var-dumper": "^4|^5|^6|^7"
},
"replace": {
"maximebf/debugbar": "self.version"
},
"require-dev": {
"dbrekelmans/bdi": "^1",
"phpunit/phpunit": "^8|^9",
"symfony/panther": "^1|^2.1",
"twig/twig": "^1.38|^2.7|^3.0"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/php-debugbar/php-debugbar",
"keywords": [
"debug",
"debug bar",
"debugbar",
"dev"
],
"support": {
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
"source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.4"
},
"time": "2025-07-22T14:01:30+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
@@ -8945,23 +9103,23 @@
},
{
"name": "symfony/finder",
"version": "v7.4.4",
"version": "v7.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "01b24a145bbeaa7141e75887ec904c34a6728a5f"
"reference": "2a6614966ba1074fa93dae0bc804227422df4dfe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/01b24a145bbeaa7141e75887ec904c34a6728a5f",
"reference": "01b24a145bbeaa7141e75887ec904c34a6728a5f",
"url": "https://api.github.com/repos/symfony/finder/zipball/2a6614966ba1074fa93dae0bc804227422df4dfe",
"reference": "2a6614966ba1074fa93dae0bc804227422df4dfe",
"shasum": ""
},
"require": {
"php": ">=8.2"
},
"require-dev": {
"symfony/filesystem": "^6.4|^7.0|^8.0"
"symfony/filesystem": "^6.4|^7.0"
},
"type": "library",
"autoload": {
@@ -8989,7 +9147,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v7.4.4"
"source": "https://github.com/symfony/finder/tree/v7.3.2"
},
"funding": [
{
@@ -9009,26 +9167,27 @@
"type": "tidelift"
}
],
"time": "2026-01-12T12:19:02+00:00"
"time": "2025-07-15T13:41:35+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v7.4.4",
"version": "v7.3.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "977a554a34cf8edc95ca351fbecb1bb1ad05cc94"
"reference": "db488a62f98f7a81d5746f05eea63a74e55bb7c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/977a554a34cf8edc95ca351fbecb1bb1ad05cc94",
"reference": "977a554a34cf8edc95ca351fbecb1bb1ad05cc94",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/db488a62f98f7a81d5746f05eea63a74e55bb7c4",
"reference": "db488a62f98f7a81d5746f05eea63a74e55bb7c4",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-mbstring": "^1.1"
"symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/polyfill-mbstring": "~1.1",
"symfony/polyfill-php83": "^1.27"
},
"conflict": {
"doctrine/dbal": "<3.6",
@@ -9037,13 +9196,13 @@
"require-dev": {
"doctrine/dbal": "^3.6|^4",
"predis/predis": "^1.1|^2.0",
"symfony/cache": "^6.4.12|^7.1.5|^8.0",
"symfony/clock": "^6.4|^7.0|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/expression-language": "^6.4|^7.0|^8.0",
"symfony/http-kernel": "^6.4|^7.0|^8.0",
"symfony/mime": "^6.4|^7.0|^8.0",
"symfony/rate-limiter": "^6.4|^7.0|^8.0"
"symfony/cache": "^6.4.12|^7.1.5",
"symfony/clock": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/expression-language": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/mime": "^6.4|^7.0",
"symfony/rate-limiter": "^6.4|^7.0"
},
"type": "library",
"autoload": {
@@ -9071,7 +9230,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v7.4.4"
"source": "https://github.com/symfony/http-foundation/tree/v7.3.7"
},
"funding": [
{
@@ -9091,7 +9250,7 @@
"type": "tidelift"
}
],
"time": "2026-01-09T12:14:21+00:00"
"time": "2025-11-08T16:41:12+00:00"
},
{
"name": "symfony/http-kernel",
@@ -9297,21 +9456,20 @@
},
{
"name": "symfony/mime",
"version": "v7.4.4",
"version": "v7.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "40945014c0a9471ccfe19673c54738fa19367a3c"
"reference": "e0a0f859148daf1edf6c60b398eb40bfc96697d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/40945014c0a9471ccfe19673c54738fa19367a3c",
"reference": "40945014c0a9471ccfe19673c54738fa19367a3c",
"url": "https://api.github.com/repos/symfony/mime/zipball/e0a0f859148daf1edf6c60b398eb40bfc96697d1",
"reference": "e0a0f859148daf1edf6c60b398eb40bfc96697d1",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-intl-idn": "^1.10",
"symfony/polyfill-mbstring": "^1.0"
},
@@ -9326,11 +9484,11 @@
"egulias/email-validator": "^2.1.10|^3.1|^4",
"league/html-to-markdown": "^5.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/property-access": "^6.4|^7.0|^8.0",
"symfony/property-info": "^6.4|^7.0|^8.0",
"symfony/serializer": "^6.4.3|^7.0.3|^8.0"
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/property-access": "^6.4|^7.0",
"symfony/property-info": "^6.4|^7.0",
"symfony/serializer": "^6.4.3|^7.0.3"
},
"type": "library",
"autoload": {
@@ -9362,7 +9520,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v7.4.4"
"source": "https://github.com/symfony/mime/tree/v7.3.2"
},
"funding": [
{
@@ -9382,7 +9540,7 @@
"type": "tidelift"
}
],
"time": "2026-01-08T16:12:55+00:00"
"time": "2025-07-15T13:41:35+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -10714,16 +10872,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v7.4.4",
"version": "v7.3.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "0e4769b46a0c3c62390d124635ce59f66874b282"
"reference": "34d8d4c4b9597347306d1ec8eb4e1319b1e6986f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e4769b46a0c3c62390d124635ce59f66874b282",
"reference": "0e4769b46a0c3c62390d124635ce59f66874b282",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/34d8d4c4b9597347306d1ec8eb4e1319b1e6986f",
"reference": "34d8d4c4b9597347306d1ec8eb4e1319b1e6986f",
"shasum": ""
},
"require": {
@@ -10735,10 +10893,10 @@
"symfony/console": "<6.4"
},
"require-dev": {
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/http-kernel": "^6.4|^7.0|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/uid": "^6.4|^7.0|^8.0",
"symfony/console": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/uid": "^6.4|^7.0",
"twig/twig": "^3.12"
},
"bin": [
@@ -10777,7 +10935,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v7.4.4"
"source": "https://github.com/symfony/var-dumper/tree/v7.3.3"
},
"funding": [
{
@@ -10797,7 +10955,7 @@
"type": "tidelift"
}
],
"time": "2026-01-01T22:13:48+00:00"
"time": "2025-08-13T11:49:31+00:00"
},
{
"name": "tabuna/breadcrumbs",
@@ -12613,108 +12771,6 @@
],
"time": "2025-09-10T09:51:40+00:00"
},
{
"name": "fruitcake/laravel-debugbar",
"version": "v4.0.7",
"source": {
"type": "git",
"url": "https://github.com/fruitcake/laravel-debugbar.git",
"reference": "a9cc62c81cd0bda4ca7410229487638d7df786be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/a9cc62c81cd0bda4ca7410229487638d7df786be",
"reference": "a9cc62c81cd0bda4ca7410229487638d7df786be",
"shasum": ""
},
"require": {
"illuminate/routing": "^11|^12",
"illuminate/session": "^11|^12",
"illuminate/support": "^11|^12",
"php": "^8.2",
"php-debugbar/php-debugbar": "^3.1",
"php-debugbar/symfony-bridge": "^1.1"
},
"replace": {
"barryvdh/laravel-debugbar": "self.version"
},
"require-dev": {
"larastan/larastan": "^3",
"laravel/octane": "^2",
"laravel/pennant": "^1",
"laravel/pint": "^1",
"laravel/telescope": "^5.16",
"livewire/livewire": "^3.7|^4",
"mockery/mockery": "^1.3.3",
"orchestra/testbench-dusk": "^9|^10",
"php-debugbar/twig-bridge": "^2.0",
"phpstan/phpstan-phpunit": "^2",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^11",
"shipmonk/phpstan-rules": "^4.3"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Debugbar": "Fruitcake\\LaravelDebugbar\\Facades\\Debugbar"
},
"providers": [
"Fruitcake\\LaravelDebugbar\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Fruitcake\\LaravelDebugbar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fruitcake",
"homepage": "https://fruitcake.nl"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "PHP Debugbar integration for Laravel",
"keywords": [
"barryvdh",
"debug",
"debugbar",
"dev",
"laravel",
"profiler",
"webprofiler"
],
"support": {
"issues": "https://github.com/fruitcake/laravel-debugbar/issues",
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.0.7"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2026-02-06T20:53:50+00:00"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v2.1.1",
@@ -13552,174 +13608,6 @@
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "php-debugbar/php-debugbar",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/php-debugbar/php-debugbar.git",
"reference": "a1f4e156811f000efb6e118178832581fab94f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/a1f4e156811f000efb6e118178832581fab94f11",
"reference": "a1f4e156811f000efb6e118178832581fab94f11",
"shasum": ""
},
"require": {
"php": "^8.2",
"psr/log": "^1|^2|^3",
"symfony/var-dumper": "^5.4|^6|^7|^8"
},
"replace": {
"maximebf/debugbar": "self.version"
},
"require-dev": {
"dbrekelmans/bdi": "^1.4",
"friendsofphp/php-cs-fixer": "^3.92",
"monolog/monolog": "^3.9",
"php-debugbar/doctrine-bridge": "^3@dev",
"php-debugbar/monolog-bridge": "^1@dev",
"php-debugbar/symfony-bridge": "^1@dev",
"php-debugbar/twig-bridge": "^2@dev",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^10",
"predis/predis": "^3.3",
"shipmonk/phpstan-rules": "^4.3",
"symfony/browser-kit": "^6.4|7.0",
"symfony/dom-crawler": "^6.4|^7",
"symfony/event-dispatcher": "^5.4|^6.4|^7.3|^8.0",
"symfony/http-foundation": "^5.4|^6.4|^7.3|^8.0",
"symfony/mailer": "^5.4|^6.4|^7.3|^8.0",
"symfony/panther": "^1|^2.1",
"twig/twig": "^3.11.2"
},
"suggest": {
"php-debugbar/doctrine-bridge": "To integrate Doctrine with php-debugbar.",
"php-debugbar/monolog-bridge": "To integrate Monolog with php-debugbar.",
"php-debugbar/symfony-bridge": "To integrate Symfony with php-debugbar.",
"php-debugbar/twig-bridge": "To integrate Twig with php-debugbar."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/php-debugbar/php-debugbar",
"keywords": [
"debug",
"debug bar",
"debugbar",
"dev",
"profiler",
"toolbar"
],
"support": {
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
"source": "https://github.com/php-debugbar/php-debugbar/tree/v3.2.2"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2026-01-25T20:59:56+00:00"
},
{
"name": "php-debugbar/symfony-bridge",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-debugbar/symfony-bridge.git",
"reference": "e37d2debe5d316408b00d0ab2688d9c2cf59b5ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-debugbar/symfony-bridge/zipball/e37d2debe5d316408b00d0ab2688d9c2cf59b5ad",
"reference": "e37d2debe5d316408b00d0ab2688d9c2cf59b5ad",
"shasum": ""
},
"require": {
"php": "^8.2",
"php-debugbar/php-debugbar": "^3.1",
"symfony/http-foundation": "^5.4|^6.4|^7.3|^8.0"
},
"require-dev": {
"dbrekelmans/bdi": "^1.4",
"phpunit/phpunit": "^10",
"symfony/browser-kit": "^6|^7",
"symfony/dom-crawler": "^6|^7",
"symfony/mailer": "^5.4|^6.4|^7.3|^8.0",
"symfony/panther": "^1|^2.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\Bridge\\Symfony\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Symfony bridge for PHP Debugbar",
"homepage": "https://github.com/php-debugbar/php-debugbar",
"keywords": [
"debugbar",
"dev",
"symfony"
],
"support": {
"issues": "https://github.com/php-debugbar/symfony-bridge/issues",
"source": "https://github.com/php-debugbar/symfony-bridge/tree/v1.1.0"
},
"time": "2026-01-15T14:47:34+00:00"
},
{
"name": "php-mock/php-mock",
"version": "2.6.2",
+102 -301
View File
@@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
return [
/*
@@ -12,53 +10,98 @@ return [
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED'),
'collect_jobs' => env('DEBUGBAR_COLLECT_JOBS', false),
'except' => [
'telescope*',
'horizon*',
'_boost/browser-logs',
'enabled' => null,
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo
'path' => storage_path().'/debugbar', // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
],
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
*/
'capture_ajax' => true,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => true,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => env('DEBUGBAR_COLLECTORS_PHPINFO', true), // Php version
'messages' => env('DEBUGBAR_COLLECTORS_MESSAGES', true), // Messages
'time' => env('DEBUGBAR_COLLECTORS_TIME', true), // Time Datalogger
'memory' => env('DEBUGBAR_COLLECTORS_MEMORY', true), // Memory usage
'exceptions' => env('DEBUGBAR_COLLECTORS_EXCEPTIONS', true), // Exception displayer
'log' => env('DEBUGBAR_COLLECTORS_LOG', true), // Logs from Monolog (merged in messages if enabled)
'db' => env('DEBUGBAR_COLLECTORS_DB', true), // Show database (PDO) queries and bindings
'views' => env('DEBUGBAR_COLLECTORS_VIEWS', true), // Views with their data
'route' => env('DEBUGBAR_COLLECTORS_ROUTE', true), // Current route information
'auth' => env('DEBUGBAR_COLLECTORS_AUTH', true), // Display Laravel authentication status
'gate' => env('DEBUGBAR_COLLECTORS_GATE', true), // Display Laravel Gate checks
'session' => env('DEBUGBAR_COLLECTORS_SESSION', true), // Display session data
'symfony_request' => env('DEBUGBAR_COLLECTORS_SYMFONY_REQUEST', false), // Default Request Data
'mail' => env('DEBUGBAR_COLLECTORS_MAIL', true), // Catch mail messages
'laravel' => env('DEBUGBAR_COLLECTORS_LARAVEL', true), // Laravel version and environment
'events' => env('DEBUGBAR_COLLECTORS_EVENTS', true), // All events fired
'logs' => env('DEBUGBAR_COLLECTORS_LOGS', true), // Add the latest log messages
'config' => env('DEBUGBAR_COLLECTORS_CONFIG', false), // Display config settings
'cache' => env('DEBUGBAR_COLLECTORS_CACHE', true), // Display cache events
'models' => env('DEBUGBAR_COLLECTORS_MODELS', true), // Display models
'livewire' => env('DEBUGBAR_COLLECTORS_LIVEWIRE', true), // Display Livewire (when available)
'inertia' => env('DEBUGBAR_COLLECTORS_INERTIA', true), // Display Inertia (when available)
'jobs' => env('DEBUGBAR_COLLECTORS_JOBS', true), // Display dispatched jobs
'pennant' => env('DEBUGBAR_COLLECTORS_PENNANT', true), // Display Pennant feature flags
'http_client' => env('DEBUGBAR_COLLECTORS_HTTP_CLIENT', true), // Display HTTP Client requests
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'laravel' => true, // Laravel version and environment
'events' => true, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'logs' => true, // Add the latest log messages
'files' => true, // Show the included files
'config' => false, // Display config settings
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
],
/*
@@ -71,298 +114,56 @@ return [
*/
'options' => [
'time' => [
'memory_usage' => env('DEBUGBAR_OPTIONS_TIME_MEMORY_USAGE', false), // Calculated by subtracting memory start and end, it may be inaccurate
],
'messages' => [
'trace' => env('DEBUGBAR_OPTIONS_MESSAGES_TRACE', true), // Trace the origin of the debug message
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'capture_dumps' => env('DEBUGBAR_OPTIONS_MESSAGES_CAPTURE_DUMPS', false), // Capture laravel `dump();` as message
'timeline' => env('DEBUGBAR_OPTIONS_MESSAGES_TIMELINE', true), // Add messages to the timeline
],
'memory' => [
'reset_peak' => env('DEBUGBAR_OPTIONS_MEMORY_RESET_PEAK', false), // run memory_reset_peak_usage before collecting
'with_baseline' => env('DEBUGBAR_OPTIONS_MEMORY_WITH_BASELINE', false), // Set boot memory usage as memory peak baseline
'precision' => (int) env('DEBUGBAR_OPTIONS_MEMORY_PRECISION', 0), // Memory rounding precision
],
'auth' => [
'show_name' => env('DEBUGBAR_OPTIONS_AUTH_SHOW_NAME', false), // Also show the users name/email in the debugbar
'show_guards' => env('DEBUGBAR_OPTIONS_AUTH_SHOW_GUARDS', true), // Show the guards that are used
],
'gate' => [
'trace' => false, // Trace the origin of the Gate checks
'timeline' => env('DEBUGBAR_OPTIONS_GATE_TIMELINE', false), // Add mails to the timeline
'show_name' => false, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => env('DEBUGBAR_OPTIONS_WITH_PARAMS', true), // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
//'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
'with_params' => true, // Render SQL with the parameters substituted
'timeline' => true, // Add the queries to the timeline
'backtrace' => true, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
],
'backtrace' => env('DEBUGBAR_OPTIONS_DB_BACKTRACE', true), // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => env('DEBUGBAR_OPTIONS_DB_TIMELINE', true), // Add the queries to the timeline
'duration_background' => env('DEBUGBAR_OPTIONS_DB_DURATION_BACKGROUND', true), // Show shaded background on each query relative to how long it took to execute.
'explain' => [ // Show EXPLAIN output on queries
'enabled' => env('DEBUGBAR_OPTIONS_DB_EXPLAIN_ENABLED', false),
],
'only_slow_queries' => env('DEBUGBAR_OPTIONS_DB_ONLY_SLOW_QUERIES', true), // Only track queries that last longer than `slow_threshold`
'slow_threshold' => env('DEBUGBAR_OPTIONS_DB_SLOW_THRESHOLD', false), // Max query execution time (ms). Exceeding queries will be highlighted
'memory_usage' => env('DEBUGBAR_OPTIONS_DB_MEMORY_USAGE', false), // Show queries memory usage
'soft_limit' => (int) env('DEBUGBAR_OPTIONS_DB_SOFT_LIMIT', 100), // After the soft limit, no parameters/backtrace are captured
'hard_limit' => (int) env('DEBUGBAR_OPTIONS_DB_HARD_LIMIT', 500), // After the hard limit, queries are ignored
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'timeline' => env('DEBUGBAR_OPTIONS_MAIL_TIMELINE', true), // Add mails to the timeline
'show_body' => env('DEBUGBAR_OPTIONS_MAIL_SHOW_BODY', true),
'full_log' => false,
],
'views' => [
'timeline' => env('DEBUGBAR_OPTIONS_VIEWS_TIMELINE', true), // Add the views to the timeline
'data' => env('DEBUGBAR_OPTIONS_VIEWS_DATA', false), // True for all data, 'keys' for only names, false for no parameters.
'group' => (int) env('DEBUGBAR_OPTIONS_VIEWS_GROUP', 50), // Group duplicate views. Pass value to auto-group, or true/false to force
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
'vendor/filament', // Exclude Filament components by default
],
],
'inertia' => [
'pages' => env('DEBUGBAR_OPTIONS_VIEWS_INERTIA_PAGES', 'js/Pages'), // Path for Inertia views
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => env('DEBUGBAR_OPTIONS_ROUTE_LABEL', true), // Show complete route on bar
],
'session' => [
'masked' => [], // List of keys that are masked
],
'symfony_request' => [
'label' => env('DEBUGBAR_OPTIONS_SYMFONY_REQUEST_LABEL', true), // Show route on bar
'masked' => [], // List of keys that are masked
],
'events' => [
'data' => env('DEBUGBAR_OPTIONS_EVENTS_DATA', false), // Collect events data
'listeners' => env('DEBUGBAR_OPTIONS_EVENTS_LISTENERS', false), // Add listeners to the events data
'excluded' => [], // Example: ['eloquent.*', 'composing', Illuminate\Cache\Events\CacheHit::class]
'label' => true, // show complete route on bar
],
'logs' => [
'file' => env('DEBUGBAR_OPTIONS_LOGS_FILE'),
],
'cache' => [
'values' => env('DEBUGBAR_OPTIONS_CACHE_VALUES', true), // Collect cache values
'timeline' => env('DEBUGBAR_OPTIONS_CACHE_TIMELINE', false), // Add mails to the timeline
],
'http_client' => [
'masked' => [],
'timeline' => env('DEBUGBAR_OPTIONS_HTTP_CLIENT_TIMELINE', true), // Add requests to the timeline
'file' => null,
],
],
/**
* Add any additional DataCollectors by adding the class name of a DataCollector or invokable class.
*/
'custom_collectors' => [
// MyCollector::class => env('DEBUGBAR_COLLECTORS_MYCOLLECTOR', true),
],
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking file name.
|
| Supported: "sublime", "textmate", "emacs", "macvim", "codelite",
| "phpstorm", "phpstorm-remote", "idea", "idea-remote",
| "vscode", "vscode-insiders", "vscode-remote", "vscode-insiders-remote",
| "vscodium", "nova", "xdebug", "atom", "espresso",
| "netbeans", "cursor", "windsurf", "zed", "antigravity"
|
*/
'editor' => env('DEBUGBAR_EDITOR') ?: env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
|
| Note for your request to be identified as ajax requests they must either send the header
| X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header.
|
| By default `ajax_handler_auto_show` is set to true allowing ajax requests to be shown automatically in the Debugbar.
| Changing `ajax_handler_auto_show` to false will prevent the Debugbar from reloading.
|
| You can defer loading the dataset, so it will be loaded with ajax after the request is done. (Experimental)
*/
'capture_ajax' => env('DEBUGBAR_CAPTURE_AJAX', true),
'add_ajax_timing' => env('DEBUGBAR_ADD_AJAX_TIMING', false),
'ajax_handler_auto_show' => env('DEBUGBAR_AJAX_HANDLER_AUTO_SHOW', true),
'ajax_handler_enable_tab' => env('DEBUGBAR_AJAX_HANDLER_ENABLE_TAB', true),
'defer_datasets' => env('DEBUGBAR_DEFER_DATASETS', false),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Debugbar will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH'),
'local_sites_path' => env('DEBUGBAR_LOCAL_SITES_PATH', env('IGNITION_LOCAL_SITES_PATH')),
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| Debugbar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Sqlite will
| create a database file in the storage folder.
| Redis and PDO can also be used. For PDO, run the package migrations first.
|
| Warning: Enabling storage.open will allow everyone to access previous
| request, do not enable open storage in publicly available environments!
| Specify a callback if you want to limit based on IP or authentication.
| Leaving it to null will allow localhost only.
*/
'storage' => [
'enabled' => env('DEBUGBAR_STORAGE_ENABLED', true),
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
'driver' => env('DEBUGBAR_STORAGE_DRIVER', 'file'), // redis, file, sqlite, pdo, custom
'path' => env('DEBUGBAR_STORAGE_PATH', storage_path('debugbar')), // For file driver
'connection' => env('DEBUGBAR_STORAGE_CONNECTION'), // Leave null for default connection (Redis/PDO)
'provider' => env('DEBUGBAR_STORAGE_PROVIDER', ''), // Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Assets
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: (none)
| and for js: highlight.js
| So if you want syntax highlighting, set it to true.
|
*/
'use_dist_files' => env('DEBUGBAR_USE_DIST_FILES', true),
'include_vendors' => env('DEBUGBAR_INCLUDE_VENDORS', true),
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
| You can set a custom error reporting level to filter which errors are
| handled. For example, to exclude deprecation warnings:
| E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
| To exclude notices, strict warnings, and deprecations:
| E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
| Defaults to E_ALL (all errors).
|
*/
'error_handler' => env('DEBUGBAR_ERROR_HANDLER', false),
'error_level' => env('DEBUGBAR_ERROR_LEVEL', E_ALL),
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => env('DEBUGBAR_CLOCKWORK', true),
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Usually, the debugbar is added just before <body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => env('DEBUGBAR_INJECT', true),
'inject' => true,
/*
|--------------------------------------------------------------------------
| Debugbar route prefix
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by Debugbar to load
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => env('DEBUGBAR_ROUTE_PREFIX', '_debugbar'),
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| Debugbar route middleware
|--------------------------------------------------------------------------
|
| Additional middleware to run on the Debugbar routes
*/
'route_middleware' => [],
/*
|--------------------------------------------------------------------------
| Debugbar route domain
|--------------------------------------------------------------------------
|
| By default Debugbar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => env('DEBUGBAR_ROUTE_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Debugbar theme
|--------------------------------------------------------------------------
|
| Switches between light and dark theme. If set to auto it will respect system preferences
| Possible values: auto, light, dark
*/
'theme' => env('DEBUGBAR_THEME', 'auto'),
/*
|--------------------------------------------------------------------------
| Backtrace stack limit
|--------------------------------------------------------------------------
|
| By default, the Debugbar limits the number of frames returned by the 'debug_backtrace()' function.
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
*/
'debug_backtrace_limit' => (int) env('DEBUGBAR_DEBUG_BACKTRACE_LIMIT', 50),
];
+33 -137
View File
@@ -2,81 +2,6 @@
return [
/*
|---------------------------------------------------------------------------
| Component Locations
|---------------------------------------------------------------------------
|
| This value sets the root directories that'll be used to resolve view-based
| components like single and multi-file components. The make command will
| use the first directory in this array to add new component files to.
|
*/
'component_locations' => [
resource_path('views/livewire'),
],
/*
|---------------------------------------------------------------------------
| Component Namespaces
|---------------------------------------------------------------------------
|
| This value sets default namespaces that will be used to resolve view-based
| components like single-file and multi-file components. These folders'll
| also be referenced when creating new components via the make command.
|
*/
'component_namespaces' => [
'layouts' => resource_path('views/layouts'),
'pages' => resource_path('views/pages'),
],
/*
|---------------------------------------------------------------------------
| Page Layout
|---------------------------------------------------------------------------
| The view that will be used as the layout when rendering a single component as
| an entire page via `Route::livewire('/post/create', 'pages::create-post')`.
| In this case, the content of pages::create-post will render into $slot.
|
*/
'component_layout' => 'layouts::app',
/*
|---------------------------------------------------------------------------
| Lazy Loading Placeholder
|---------------------------------------------------------------------------
| Livewire allows you to lazy load components that would otherwise slow down
| the initial page load. Every component can have a custom placeholder or
| you can define the default placeholder view for all components below.
|
*/
'component_placeholder' => null, // Example: 'placeholders::skeleton'
/*
|---------------------------------------------------------------------------
| Make Command
|---------------------------------------------------------------------------
| This value determines the default configuration for the artisan make command
| You can configure the component type (sfc, mfc, class) and whether to use
| the high-voltage () emoji as a prefix in the sfc|mfc component names.
|
*/
'make_command' => [
'type' => 'class', // Options: 'sfc', 'mfc', 'class'
'emoji' => false, // Options: true, false
'with' => [
'js' => false,
'css' => false,
'test' => false,
],
],
/*
|---------------------------------------------------------------------------
| Class Namespace
@@ -90,19 +15,6 @@ return [
'class_namespace' => 'App\\Livewire',
/*
|---------------------------------------------------------------------------
| Class Path
|---------------------------------------------------------------------------
|
| This value is used to specify the path where Livewire component class files
| are created when running creation commands like `artisan make:livewire`.
| This path is customizable to match your projects directory structure.
|
*/
'class_path' => app_path('Livewire'),
/*
|---------------------------------------------------------------------------
| View Path
@@ -116,6 +28,30 @@ return [
'view_path' => resource_path('views/livewire'),
/*
|---------------------------------------------------------------------------
| Layout
|---------------------------------------------------------------------------
| The view that will be used as the layout when rendering a single component
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
| In this case, the view returned by CreatePost will render into $slot.
|
*/
'layout' => 'components.layouts.app',
/*
|---------------------------------------------------------------------------
| Lazy Loading Placeholder
|---------------------------------------------------------------------------
| Livewire allows you to lazy load components that would otherwise slow down
| the initial page load. Every component can have a custom placeholder or
| you can define the default placeholder view for all components below.
|
*/
'lazy_placeholder' => null,
/*
|---------------------------------------------------------------------------
| Temporary File Uploads
@@ -209,19 +145,6 @@ return [
'inject_morph_markers' => true,
/*
|---------------------------------------------------------------------------
| Smart Wire Keys
|---------------------------------------------------------------------------
|
| Livewire uses loops and keys used within loops to generate smart keys that
| are applied to nested components that don't have them. This makes using
| nested components more reliable by ensuring that they all have keys.
|
*/
'smart_wire_keys' => true,
/*
|---------------------------------------------------------------------------
| Pagination Theme
@@ -237,45 +160,18 @@ return [
/*
|---------------------------------------------------------------------------
| Release Token
| URL Prefix
|---------------------------------------------------------------------------
|
| This token is stored client-side and sent along with each request to check
| a users session to see if a new release has invalidated it. If there is
| a mismatch it will throw an error and prompt for a browser refresh.
| By default, Livewire sends network requests to {app.com}/livewire/update
| while javascript assets are served via {app.com}/livewire/livewire.js
| If you need to adjust the prefix of those urls you can do it below.
|
| Defining a prefix will result in the following url
| {app.com}/{prefix}/livewire/{update|livewire.js}
| Note: do not include the leading or trailing /
|
*/
'release_token' => 'a',
/*
|---------------------------------------------------------------------------
| CSP Safe
|---------------------------------------------------------------------------
|
| This config is used to determine if Livewire will use the CSP-safe version
| of Alpine in its bundle. This is useful for applications that are using
| strict Content Security Policy (CSP) to protect against XSS attacks.
|
*/
'csp_safe' => false,
/*
|---------------------------------------------------------------------------
| Payload Guards
|---------------------------------------------------------------------------
|
| These settings protect against malicious or oversized payloads that could
| cause denial of service. The default values should feel reasonable for
| most web applications. Each can be set to null to disable the limit.
|
*/
'payload' => [
'max_size' => 1024 * 1024, // 1MB - maximum request payload size in bytes
'max_nesting_depth' => 10, // Maximum depth of dot-notation property paths
'max_calls' => 50, // Maximum method calls per request
'max_components' => 20, // Maximum components per batch request
],
'url_prefix' => env('LIVEWIRE_URL_PREFIX', null),
];

Some files were not shown because too many files have changed in this diff Show More