Cleaned up facade names and references

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-05-29 12:38:15 +01:00
parent 369c819a27
commit fb233c0aa4
107 changed files with 332 additions and 298 deletions

View file

@ -7,7 +7,7 @@ use Illuminate\Console\Command;
use App\Models\User; use App\Models\User;
use Laravel\Passport\TokenRepository; use Laravel\Passport\TokenRepository;
use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use DB; use Illuminate\Support\Facades\DB;
class GeneratePersonalAccessToken extends Command class GeneratePersonalAccessToken extends Command
{ {

View file

@ -9,7 +9,7 @@ use App\Models\Setting;
use App\Models\Ldap; use App\Models\Ldap;
use App\Models\User; use App\Models\User;
use App\Models\Location; use App\Models\Location;
use Log; use Illuminate\Support\Facades\Log;
class LdapSync extends Command class LdapSync extends Command
{ {
@ -298,7 +298,7 @@ class LdapSync extends Command
try { try {
$ldap_manager = Ldap::findLdapUsers($item['manager'], -1, $this->option('filter')); $ldap_manager = Ldap::findLdapUsers($item['manager'], -1, $this->option('filter'));
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::warning("Manager lookup caused an exception: " . $e->getMessage() . ". Falling back to direct username lookup"); Log::warning("Manager lookup caused an exception: " . $e->getMessage() . ". Falling back to direct username lookup");
// Hail-mary for Okta manager 'shortnames' - will only work if // Hail-mary for Okta manager 'shortnames' - will only work if
// Okta configuration is using full email-address-style usernames // Okta configuration is using full email-address-style usernames
$ldap_manager = [ $ldap_manager = [

View file

@ -5,7 +5,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use App\Models\Setting; use App\Models\Setting;
use Exception; use Exception;
use Crypt; use Illuminate\Support\Facades\Crypt;
/** /**
* Check if a given ip is in a network * Check if a given ip is in a network
@ -160,7 +160,7 @@ class LdapTroubleshooter extends Command
$output[] = "-x"; $output[] = "-x";
$output[] = "-b ".escapeshellarg($settings->ldap_basedn); $output[] = "-b ".escapeshellarg($settings->ldap_basedn);
$output[] = "-D ".escapeshellarg($settings->ldap_uname); $output[] = "-D ".escapeshellarg($settings->ldap_uname);
$output[] = "-w ".escapeshellarg(\Crypt::Decrypt($settings->ldap_pword)); $output[] = "-w ".escapeshellarg(Crypt::Decrypt($settings->ldap_pword));
$output[] = escapeshellarg(parenthesized_filter($settings->ldap_filter)); $output[] = escapeshellarg(parenthesized_filter($settings->ldap_filter));
if($settings->ldap_tls) { if($settings->ldap_tls) {
$this->line("# adding STARTTLS option"); $this->line("# adding STARTTLS option");

View file

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
class MoveUploadsToNewDisk extends Command class MoveUploadsToNewDisk extends Command
{ {
@ -74,7 +75,7 @@ class MoveUploadsToNewDisk extends Command
$new_url = Storage::disk('public')->url('uploads/'.$public_type.'/'.$filename, $filename); $new_url = Storage::disk('public')->url('uploads/'.$public_type.'/'.$filename, $filename);
$this->info($type_count.'. PUBLIC: '.$filename.' was copied to '.$new_url); $this->info($type_count.'. PUBLIC: '.$filename.' was copied to '.$new_url);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
$this->error($e); $this->error($e);
} }
} }
@ -116,7 +117,7 @@ class MoveUploadsToNewDisk extends Command
$new_url = Storage::url($private_type . '/' . $filename, $filename); $new_url = Storage::url($private_type . '/' . $filename, $filename);
$this->info($type_count . '. PRIVATE: ' . $filename . ' was copied to ' . $new_url); $this->info($type_count . '. PRIVATE: ' . $filename . ' was copied to ' . $new_url);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
$this->error($e); $this->error($e);
} }
} }
@ -140,7 +141,7 @@ class MoveUploadsToNewDisk extends Command
unlink($filename); unlink($filename);
$public_delete_count++; $public_delete_count++;
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
$this->error($e); $this->error($e);
} }
} }
@ -153,7 +154,7 @@ class MoveUploadsToNewDisk extends Command
unlink($filename); unlink($filename);
$private_delete_count++; $private_delete_count++;
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
$this->error($e); $this->error($e);
} }
} }

View file

@ -5,6 +5,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Illuminate\Support\Facades\Log;
ini_set('max_execution_time', env('IMPORT_TIME_LIMIT', 600)); //600 seconds = 10 minutes ini_set('max_execution_time', env('IMPORT_TIME_LIMIT', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('IMPORT_MEMORY_LIMIT', '500M')); ini_set('memory_limit', env('IMPORT_MEMORY_LIMIT', '500M'));
@ -59,7 +60,7 @@ class ObjectImportCommand extends Command
// This $logFile/useFiles() bit is currently broken, so commenting it out for now // This $logFile/useFiles() bit is currently broken, so commenting it out for now
// $logFile = $this->option('logfile'); // $logFile = $this->option('logfile');
// \Log::useFiles($logFile); // Log::useFiles($logFile);
$this->comment('======= Importing Items from '.$filename.' ========='); $this->comment('======= Importing Items from '.$filename.' =========');
$importer->import(); $importer->import();
@ -112,10 +113,10 @@ class ObjectImportCommand extends Command
public function log($string, $level = 'info') public function log($string, $level = 'info')
{ {
if ($level === 'warning') { if ($level === 'warning') {
\Log::warning($string); Log::warning($string);
$this->comment($string); $this->comment($string);
} else { } else {
\Log::Info($string); Log::Info($string);
if ($this->option('verbose')) { if ($this->option('verbose')) {
$this->comment($string); $this->comment($string);
} }

View file

@ -5,7 +5,7 @@ namespace App\Console\Commands;
use App\Models\Asset; use App\Models\Asset;
use App\Models\CustomField; use App\Models\CustomField;
use Schema; use Schema;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class PaveIt extends Command class PaveIt extends Command

View file

@ -103,7 +103,7 @@ class RecryptFromMcrypt extends Command
$this->comment('INFO: No LDAP password found. Skipping... '); $this->comment('INFO: No LDAP password found. Skipping... ');
} else { } else {
$decrypted_ldap_pword = $mcrypter->decrypt($settings->ldap_pword); $decrypted_ldap_pword = $mcrypter->decrypt($settings->ldap_pword);
$settings->ldap_pword = \Crypt::encrypt($decrypted_ldap_pword); $settings->ldap_pword = Crypt::encrypt($decrypted_ldap_pword);
$settings->save(); $settings->save();
} }
/** @var CustomField[] $custom_fields */ /** @var CustomField[] $custom_fields */
@ -132,7 +132,7 @@ class RecryptFromMcrypt extends Command
// Try to decrypt the payload using the legacy app key // Try to decrypt the payload using the legacy app key
try { try {
$decrypted_field = $mcrypter->decrypt($asset->{$columnName}); $decrypted_field = $mcrypter->decrypt($asset->{$columnName});
$asset->{$columnName} = \Crypt::encrypt($decrypted_field); $asset->{$columnName} = Crypt::encrypt($decrypted_field);
$this->comment($decrypted_field); $this->comment($decrypted_field);
} catch (\Exception $e) { } catch (\Exception $e) {
$errors[] = ' - ERROR: Could not decrypt field ['.$encrypted_field->name.']: '.$e->getMessage(); $errors[] = ' - ERROR: Could not decrypt field ['.$encrypted_field->name.']: '.$e->getMessage();

View file

@ -7,7 +7,7 @@ use App\Models\Asset;
use App\Models\License; use App\Models\License;
use App\Models\User; use App\Models\User;
use Artisan; use Artisan;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class RestoreDeletedUsers extends Command class RestoreDeletedUsers extends Command

View file

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use ZipArchive; use ZipArchive;
use Illuminate\Support\Facades\Log;
class SQLStreamer { class SQLStreamer {
private $input; private $input;
@ -125,7 +126,7 @@ class SQLStreamer {
while (($buffer = fgets($this->input, SQLStreamer::$buffer_size)) !== false) { while (($buffer = fgets($this->input, SQLStreamer::$buffer_size)) !== false) {
$bytes_read += strlen($buffer); $bytes_read += strlen($buffer);
if ($this->reading_beginning_of_line) { if ($this->reading_beginning_of_line) {
// \Log::debug("Buffer is: '$buffer'"); // Log::debug("Buffer is: '$buffer'");
$cleaned_buffer = $this->parse_sql($buffer); $cleaned_buffer = $this->parse_sql($buffer);
if ($this->output) { if ($this->output) {
$bytes_written = fwrite($this->output, $cleaned_buffer); $bytes_written = fwrite($this->output, $cleaned_buffer);
@ -191,7 +192,7 @@ class RestoreFromBackup extends Command
{ {
$dir = getcwd(); $dir = getcwd();
if( $dir != base_path() ) { // usually only the case when running via webserver, not via command-line if( $dir != base_path() ) { // usually only the case when running via webserver, not via command-line
\Log::debug("Current working directory is: $dir, changing directory to: ".base_path()); Log::debug("Current working directory is: $dir, changing directory to: ".base_path());
chdir(base_path()); // TODO - is this *safe* to change on a running script?! chdir(base_path()); // TODO - is this *safe* to change on a running script?!
} }
// //
@ -297,7 +298,7 @@ class RestoreFromBackup extends Command
continue; continue;
} }
if (@pathinfo($raw_path, PATHINFO_EXTENSION) == 'sql') { if (@pathinfo($raw_path, PATHINFO_EXTENSION) == 'sql') {
\Log::debug("Found a sql file!"); Log::debug("Found a sql file!");
$sqlfiles[] = $raw_path; $sqlfiles[] = $raw_path;
$sqlfile_indices[] = $i; $sqlfile_indices[] = $i;
continue; continue;
@ -413,7 +414,7 @@ class RestoreFromBackup extends Command
$bytes_read = 0; $bytes_read = 0;
while (($buffer = fgets($sql_contents, SQLStreamer::$buffer_size)) !== false) { while (($buffer = fgets($sql_contents, SQLStreamer::$buffer_size)) !== false) {
$bytes_read += strlen($buffer); $bytes_read += strlen($buffer);
// \Log::debug("Buffer is: '$buffer'"); // Log::debug("Buffer is: '$buffer'");
$bytes_written = fwrite($pipes[0], $buffer); $bytes_written = fwrite($pipes[0], $buffer);
if ($bytes_written === false) { if ($bytes_written === false) {
@ -425,13 +426,13 @@ class RestoreFromBackup extends Command
$bytes_read = $sql_importer->line_aware_piping(); $bytes_read = $sql_importer->line_aware_piping();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::error("Error during restore!!!! ".$e->getMessage()); Log::error("Error during restore!!!! ".$e->getMessage());
// FIXME - put these back and/or put them in the right places?! // FIXME - put these back and/or put them in the right places?!
$err_out = fgets($pipes[1]); $err_out = fgets($pipes[1]);
$err_err = fgets($pipes[2]); $err_err = fgets($pipes[2]);
\Log::error("Error OUTPUT: ".$err_out); Log::error("Error OUTPUT: ".$err_out);
$this->info($err_out); $this->info($err_out);
\Log::error("Error ERROR : ".$err_err); Log::error("Error ERROR : ".$err_err);
$this->error($err_err); $this->error($err_err);
throw $e; throw $e;
} }

View file

@ -7,7 +7,7 @@ use App\Models\Recipients\AlertRecipient;
use App\Models\Setting; use App\Models\Setting;
use App\Notifications\SendUpcomingAuditNotification; use App\Notifications\SendUpcomingAuditNotification;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class SendUpcomingAuditReport extends Command class SendUpcomingAuditReport extends Command

View file

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Models\Asset; use App\Models\Asset;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class SyncAssetCounters extends Command class SyncAssetCounters extends Command
{ {
@ -58,7 +59,7 @@ class SyncAssetCounters extends Command
$asset->save(); $asset->save();
$bar->advance(); $bar->advance();
\Log::debug('Asset: '.$asset->id.' has '.$asset->checkin_counter.' checkins, '.$asset->checkout_counter.' checkouts, and '.$asset->requests_counter.' requests'); Log::debug('Asset: '.$asset->id.' has '.$asset->checkin_counter.' checkins, '.$asset->checkout_counter.' checkouts, and '.$asset->requests_counter.' requests');
} }

View file

@ -7,7 +7,7 @@ use App\Helpers\Helper;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use ArieTimmerman\Laravel\SCIMServer\Exceptions\SCIMException; use ArieTimmerman\Laravel\SCIMServer\Exceptions\SCIMException;
use Log; use Illuminate\Support\Facades\Log;
use Throwable; use Throwable;
use JsonException; use JsonException;
use Carbon\Exceptions\InvalidFormatException; use Carbon\Exceptions\InvalidFormatException;
@ -44,8 +44,8 @@ class Handler extends ExceptionHandler
public function report(Throwable $exception) public function report(Throwable $exception)
{ {
if ($this->shouldReport($exception)) { if ($this->shouldReport($exception)) {
if (class_exists(\Log::class)) { if (class_exists(Log::class)) {
\Log::error($exception); Log::error($exception);
} }
return parent::report($exception); return parent::report($exception);
} }

View file

@ -12,10 +12,11 @@ use App\Models\Depreciation;
use App\Models\Setting; use App\Models\Setting;
use App\Models\Statuslabel; use App\Models\Statuslabel;
use App\Models\License; use App\Models\License;
use Crypt; use Illuminate\Support\Facades\Crypt;
use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\DecryptException;
use Image;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use Intervention\Image\ImageManagerStatic as Image;
class Helper class Helper
{ {
@ -412,7 +413,7 @@ class Helper
if ($index >= $total_colors) { if ($index >= $total_colors) {
\Log::info('Status label count is '.$index.' and exceeds the allowed count of 266.'); Log::info('Status label count is '.$index.' and exceeds the allowed count of 266.');
//patch fix for array key overflow (color count starts at 1, array starts at 0) //patch fix for array key overflow (color count starts at 1, array starts at 0)
$index = $index - $total_colors - 1; $index = $index - $total_colors - 1;
@ -1015,7 +1016,7 @@ class Helper
try { try {
$tmp_date = new \Carbon($date); $tmp_date = new Carbon($date);
if ($type == 'datetime') { if ($type == 'datetime') {
$dt['datetime'] = $tmp_date->format('Y-m-d H:i:s'); $dt['datetime'] = $tmp_date->format('Y-m-d H:i:s');
@ -1032,7 +1033,7 @@ class Helper
return $dt['formatted']; return $dt['formatted'];
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::warning($e); Log::warning($e);
return $date.' (Invalid '.$type.' value.)'; return $date.' (Invalid '.$type.' value.)';
} }
@ -1345,7 +1346,7 @@ class Helper
public static function isDemoMode() { public static function isDemoMode() {
if (config('app.lock_passwords') === true) { if (config('app.lock_passwords') === true) {
return true; return true;
\Log::debug('app locked!'); Log::debug('app locked!');
} }
return false; return false;
@ -1438,7 +1439,7 @@ class Helper
foreach (self::$language_map as $legacy => $new) { foreach (self::$language_map as $legacy => $new) {
if ($language_code == $legacy) { if ($language_code == $legacy) {
\Log::debug('Current language is '.$legacy.', using '.$new.' instead'); Log::debug('Current language is '.$legacy.', using '.$new.' instead');
return $new; return $new;
} }
} }

View file

@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Redirect; use Redirect;
use Illuminate\Support\Facades\Log;
/** This controller handles all actions related to Accessories for /** This controller handles all actions related to Accessories for
* the Snipe-IT Asset Management application. * the Snipe-IT Asset Management application.
@ -224,7 +225,7 @@ class AccessoriesController extends Controller
try { try {
Storage::disk('public')->delete('accessories'.'/'.$accessory->image); Storage::disk('public')->delete('accessories'.'/'.$accessory->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }

View file

@ -10,6 +10,7 @@ use App\Models\Accessory;
use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Symfony\Accessory\HttpFoundation\JsonResponse; use Symfony\Accessory\HttpFoundation\JsonResponse;
use Illuminate\Support\Facades\Log;
class AccessoriesFilesController extends Controller class AccessoriesFilesController extends Controller
{ {
@ -85,7 +86,7 @@ class AccessoriesFilesController extends Controller
try { try {
Storage::delete('accessories/'.$log->filename); Storage::delete('accessories/'.$log->filename);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
@ -112,7 +113,7 @@ class AccessoriesFilesController extends Controller
public function show($accessoryId = null, $fileId = null, $download = true) public function show($accessoryId = null, $fileId = null, $download = true)
{ {
\Log::debug('Private filesystem is: '.config('filesystems.default')); Log::debug('Private filesystem is: '.config('filesystems.default'));
$accessory = Accessory::find($accessoryId); $accessory = Accessory::find($accessoryId);
@ -129,8 +130,8 @@ class AccessoriesFilesController extends Controller
$file = 'private_uploads/accessories/'.$log->filename; $file = 'private_uploads/accessories/'.$log->filename;
if (Storage::missing($file)) { if (Storage::missing($file)) {
\Log::debug('FILE DOES NOT EXISTS for '.$file); Log::debug('FILE DOES NOT EXISTS for '.$file);
\Log::debug('URL should be '.Storage::url($file)); Log::debug('URL should be '.Storage::url($file));
return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) return response('File '.$file.' ('.Storage::url($file).') not found on server', 404)
->header('Content-Type', 'text/plain'); ->header('Content-Type', 'text/plain');

View file

@ -23,13 +23,13 @@ use App\Notifications\AcceptanceAssetAcceptedNotification;
use App\Notifications\AcceptanceAssetDeclinedNotification; use App\Notifications\AcceptanceAssetDeclinedNotification;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use App\Http\Controllers\SettingsController; use App\Http\Controllers\SettingsController;
use Barryvdh\DomPDF\Facade\Pdf; use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon; use Carbon\Carbon;
use phpDocumentor\Reflection\Types\Compound; use phpDocumentor\Reflection\Types\Compound;
use Illuminate\Support\Facades\Log;
class AcceptanceController extends Controller class AcceptanceController extends Controller
{ {
@ -234,7 +234,7 @@ class AcceptanceController extends Controller
]; ];
if ($pdf_view_route!='') { if ($pdf_view_route!='') {
\Log::debug($pdf_filename.' is the filename, and the route was specified.'); Log::debug($pdf_filename.' is the filename, and the route was specified.');
$pdf = Pdf::loadView($pdf_view_route, $data); $pdf = Pdf::loadView($pdf_view_route, $data);
Storage::put('private_uploads/eula-pdfs/' .$pdf_filename, $pdf->output()); Storage::put('private_uploads/eula-pdfs/' .$pdf_filename, $pdf->output());
} }
@ -321,7 +321,7 @@ class AcceptanceController extends Controller
]; ];
if ($pdf_view_route!='') { if ($pdf_view_route!='') {
\Log::debug($pdf_filename.' is the filename, and the route was specified.'); Log::debug($pdf_filename.' is the filename, and the route was specified.');
$pdf = Pdf::loadView($pdf_view_route, $data); $pdf = Pdf::loadView($pdf_view_route, $data);
Storage::put('private_uploads/eula-pdfs/' .$pdf_filename, $pdf->output()); Storage::put('private_uploads/eula-pdfs/' .$pdf_filename, $pdf->output());
} }

View file

@ -4,8 +4,8 @@ namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Models\Actionlog; use App\Models\Actionlog;
use Response; use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Log;
class ActionlogController extends Controller class ActionlogController extends Controller
{ {
public function displaySig($filename) public function displaySig($filename)
@ -20,7 +20,7 @@ class ActionlogController extends Controller
$contents = file_get_contents($file, false, stream_context_create(['http' => ['ignore_errors' => true]])); $contents = file_get_contents($file, false, stream_context_create(['http' => ['ignore_errors' => true]]));
if ($contents === false) { if ($contents === false) {
\Log::warn('File '.$file.' not found'); Log::warning('File '.$file.' not found');
return false; return false;
} else { } else {
return Response::make($contents)->header('Content-Type', $filetype); return Response::make($contents)->header('Content-Type', $filetype);

View file

@ -10,9 +10,9 @@ use App\Http\Transformers\SelectlistTransformer;
use App\Models\Accessory; use App\Models\Accessory;
use App\Models\Company; use App\Models\Company;
use App\Models\User; use App\Models\User;
use Auth; use Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;

View file

@ -8,7 +8,7 @@ use App\Http\Transformers\AssetMaintenancesTransformer;
use App\Models\Asset; use App\Models\Asset;
use App\Models\AssetMaintenance; use App\Models\AssetMaintenance;
use App\Models\Company; use App\Models\Company;
use Auth; use Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;

View file

@ -12,6 +12,7 @@ use App\Models\AssetModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
/** /**
* This class controls all actions related to asset models for * This class controls all actions related to asset models for
@ -224,7 +225,7 @@ class AssetModelsController extends Controller
try { try {
Storage::disk('public')->delete('assetmodels/'.$assetmodel->image); Storage::disk('public')->delete('assetmodels/'.$assetmodel->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::info($e); Log::info($e);
} }
} }

View file

@ -27,7 +27,7 @@ use App\Models\Setting;
use App\Models\User; use App\Models\User;
use \Illuminate\Support\Facades\Auth; use \Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -37,7 +37,7 @@ use Slack;
use Str; use Str;
use TCPDF; use TCPDF;
use Validator; use Validator;
use Route; use Illuminate\Support\Facades\Route;
/** /**

View file

@ -14,6 +14,7 @@ use App\Events\ComponentCheckedIn;
use App\Models\Asset; use App\Models\Asset;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\Log;
class ComponentsController extends Controller class ComponentsController extends Controller
{ {
@ -331,7 +332,7 @@ class ComponentsController extends Controller
// actually checked out. // actually checked out.
$component_assets->assigned_qty = $qty_remaining_in_checkout; $component_assets->assigned_qty = $qty_remaining_in_checkout;
\Log::debug($component_asset_id.' - '.$qty_remaining_in_checkout.' remaining in record '.$component_assets->id); Log::debug($component_asset_id.' - '.$qty_remaining_in_checkout.' remaining in record '.$component_assets->id);
\DB::table('components_assets')->where('id', \DB::table('components_assets')->where('id',
$component_asset_id)->update(['assigned_qty' => $qty_remaining_in_checkout]); $component_asset_id)->update(['assigned_qty' => $qty_remaining_in_checkout]);

View file

@ -13,6 +13,7 @@ use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class ConsumablesController extends Controller class ConsumablesController extends Controller
{ {
@ -277,7 +278,7 @@ class ConsumablesController extends Controller
if (!$user = User::find($request->input('assigned_to'))) { if (!$user = User::find($request->input('assigned_to'))) {
// Return error message // Return error message
return response()->json(Helper::formatStandardApiResponse('error', null, 'No user found')); return response()->json(Helper::formatStandardApiResponse('error', null, 'No user found'));
\Log::debug('No valid user'); Log::debug('No valid user');
} }
// Update the consumable data // Update the consumable data

View file

@ -8,7 +8,7 @@ use App\Http\Transformers\DepartmentsTransformer;
use App\Http\Transformers\SelectlistTransformer; use App\Http\Transformers\SelectlistTransformer;
use App\Models\Company; use App\Models\Company;
use App\Models\Department; use App\Models\Department;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;

View file

@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Http\Transformers\GroupsTransformer; use App\Http\Transformers\GroupsTransformer;
use App\Models\Group; use App\Models\Group;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Auth; use Illuminate\Support\Facades\Auth;
class GroupsController extends Controller class GroupsController extends Controller

View file

@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use League\Csv\Reader; use League\Csv\Reader;
use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Illuminate\Support\Facades\Log;
class ImportController extends Controller class ImportController extends Controller
{ {
@ -159,10 +160,10 @@ class ImportController extends Controller
// Run a backup immediately before processing // Run a backup immediately before processing
if ($request->get('run-backup')) { if ($request->get('run-backup')) {
\Log::debug('Backup manually requested via importer'); Log::debug('Backup manually requested via importer');
Artisan::call('snipeit:backup', ['--filename' => 'pre-import-backup-'.date('Y-m-d-H:i:s')]); Artisan::call('snipeit:backup', ['--filename' => 'pre-import-backup-'.date('Y-m-d-H:i:s')]);
} else { } else {
\Log::debug('NO BACKUP requested via importer'); Log::debug('NO BACKUP requested via importer');
} }
$import = Import::find($import_id); $import = Import::find($import_id);

View file

@ -8,7 +8,7 @@ use App\Http\Transformers\LabelsTransformer;
use App\Models\Labels\Label; use App\Models\Labels\Label;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\ItemNotFoundException; use Illuminate\Support\ItemNotFoundException;
use Auth; use Illuminate\Support\Facades\Auth;
class LabelsController extends Controller class LabelsController extends Controller
{ {

View file

@ -9,7 +9,7 @@ use App\Models\Asset;
use App\Models\License; use App\Models\License;
use App\Models\LicenseSeat; use App\Models\LicenseSeat;
use App\Models\User; use App\Models\User;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class LicenseSeatsController extends Controller class LicenseSeatsController extends Controller

View file

@ -12,7 +12,7 @@ use Laravel\Passport\TokenRepository;
use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use App\Models\CustomField; use App\Models\CustomField;
use DB; use Illuminate\Support\Facades\DB;
class ProfileController extends Controller class ProfileController extends Controller
{ {

View file

@ -33,18 +33,18 @@ class SettingsController extends Controller
$settings = Setting::getSettings(); $settings = Setting::getSettings();
if ($settings->ldap_enabled!='1') { if ($settings->ldap_enabled!='1') {
\Log::debug('LDAP is not enabled cannot test.'); Log::debug('LDAP is not enabled cannot test.');
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400); return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
} }
\Log::debug('Preparing to test LDAP connection'); Log::debug('Preparing to test LDAP connection');
$message = []; //where we collect together test messages $message = []; //where we collect together test messages
try { try {
$connection = Ldap::connectToLdap(); $connection = Ldap::connectToLdap();
try { try {
$message['bind'] = ['message' => 'Successfully bound to LDAP server.']; $message['bind'] = ['message' => 'Successfully bound to LDAP server.'];
\Log::debug('attempting to bind to LDAP for LDAP test'); Log::debug('attempting to bind to LDAP for LDAP test');
Ldap::bindAdminToLdap($connection); Ldap::bindAdminToLdap($connection);
$message['login'] = [ $message['login'] = [
'message' => 'Successfully connected to LDAP server.', 'message' => 'Successfully connected to LDAP server.',
@ -75,13 +75,13 @@ class SettingsController extends Controller
return response()->json($message, 200); return response()->json($message, 200);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Bind failed'); Log::debug('Bind failed');
\Log::debug("Exception was: ".$e->getMessage()); Log::debug("Exception was: ".$e->getMessage());
return response()->json(['message' => $e->getMessage()], 400); return response()->json(['message' => $e->getMessage()], 400);
//return response()->json(['message' => $e->getMessage()], 500); //return response()->json(['message' => $e->getMessage()], 500);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Connection failed but we cannot debug it any further on our end.'); Log::debug('Connection failed but we cannot debug it any further on our end.');
return response()->json(['message' => $e->getMessage()], 500); return response()->json(['message' => $e->getMessage()], 500);
} }
@ -92,7 +92,7 @@ class SettingsController extends Controller
{ {
if (Setting::getSettings()->ldap_enabled != '1') { if (Setting::getSettings()->ldap_enabled != '1') {
\Log::debug('LDAP is not enabled. Cannot test.'); Log::debug('LDAP is not enabled. Cannot test.');
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400); return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
} }
@ -104,39 +104,39 @@ class SettingsController extends Controller
$validator = Validator::make($request->all(), $rules); $validator = Validator::make($request->all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
\Log::debug('LDAP Validation test failed.'); Log::debug('LDAP Validation test failed.');
$validation_errors = implode(' ',$validator->errors()->all()); $validation_errors = implode(' ',$validator->errors()->all());
return response()->json(['message' => $validator->errors()->all()], 400); return response()->json(['message' => $validator->errors()->all()], 400);
} }
\Log::debug('Preparing to test LDAP login'); Log::debug('Preparing to test LDAP login');
try { try {
$connection = Ldap::connectToLdap(); $connection = Ldap::connectToLdap();
try { try {
Ldap::bindAdminToLdap($connection); Ldap::bindAdminToLdap($connection);
\Log::debug('Attempting to bind to LDAP for LDAP test'); Log::debug('Attempting to bind to LDAP for LDAP test');
try { try {
$ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password')); $ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
if ($ldap_user) { if ($ldap_user) {
\Log::debug('It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'); Log::debug('It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.');
return response()->json(['message' => 'It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'], 200); return response()->json(['message' => 'It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'], 200);
} }
return response()->json(['message' => 'Login Failed. '. $request->input('ldaptest_user').' did not successfully bind to LDAP.'], 400); return response()->json(['message' => 'Login Failed. '. $request->input('ldaptest_user').' did not successfully bind to LDAP.'], 400);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('LDAP login failed'); Log::debug('LDAP login failed');
return response()->json(['message' => $e->getMessage()], 400); return response()->json(['message' => $e->getMessage()], 400);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Bind failed'); Log::debug('Bind failed');
return response()->json(['message' => $e->getMessage()], 400); return response()->json(['message' => $e->getMessage()], 400);
//return response()->json(['message' => $e->getMessage()], 500); //return response()->json(['message' => $e->getMessage()], 500);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Connection failed'); Log::debug('Connection failed');
return response()->json(['message' => $e->getMessage()], 500); return response()->json(['message' => $e->getMessage()], 500);
} }
@ -181,19 +181,19 @@ class SettingsController extends Controller
$file_parts = explode('.', $file); $file_parts = explode('.', $file);
$extension = end($file_parts); $extension = end($file_parts);
\Log::debug($extension); Log::debug($extension);
// Only generated barcodes would have a .png file extension // Only generated barcodes would have a .png file extension
if ($extension == 'png') { if ($extension == 'png') {
\Log::debug('Deleting: '.$file); Log::debug('Deleting: '.$file);
try { try {
Storage::disk('public')->delete($file); Storage::disk('public')->delete($file);
\Log::debug('Deleting: '.$file); Log::debug('Deleting: '.$file);
$file_count++; $file_count++;
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
} }

View file

@ -17,9 +17,8 @@ use App\Models\Company;
use App\Models\License; use App\Models\License;
use App\Models\User; use App\Models\User;
use App\Notifications\CurrentInventory; use App\Notifications\CurrentInventory;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -559,7 +558,7 @@ class UsersController extends Controller
try { try {
Storage::disk('public')->delete('avatars/' . $user->avatar); Storage::disk('public')->delete('avatars/' . $user->avatar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }

View file

@ -6,7 +6,7 @@ use App\Helpers\Helper;
use App\Models\Asset; use App\Models\Asset;
use App\Models\AssetMaintenance; use App\Models\AssetMaintenance;
use App\Models\Company; use App\Models\Company;
use Auth; use Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Slack; use Slack;

View file

@ -15,9 +15,10 @@ use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Redirect; use Redirect;
use Request; use Illuminate\Http\Request;
use Storage; use Storage;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Illuminate\Support\Facades\Log;
/** /**
* This class controls all actions related to asset models for * This class controls all actions related to asset models for
@ -221,7 +222,7 @@ class AssetModelsController extends Controller
try { try {
Storage::disk('public')->delete('models/'.$model->image); Storage::disk('public')->delete('models/'.$model->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::info($e); Log::info($e);
} }
} }

View file

@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Log;
class AssetCheckinController extends Controller class AssetCheckinController extends Controller
{ {
@ -92,7 +93,7 @@ class AssetCheckinController extends Controller
$asset->location_id = $asset->rtd_location_id; $asset->location_id = $asset->rtd_location_id;
if ($request->filled('location_id')) { if ($request->filled('location_id')) {
\Log::debug('NEW Location ID: '.$request->get('location_id')); Log::debug('NEW Location ID: '.$request->get('location_id'));
$asset->location_id = $request->get('location_id'); $asset->location_id = $request->get('location_id');
if ($request->get('update_default_location') == 0){ if ($request->get('update_default_location') == 0){

View file

@ -207,7 +207,7 @@ class AssetsController extends Controller
} }
if ($success) { if ($success) {
\Log::debug(e($asset->asset_tag)); Log::debug(e($asset->asset_tag));
return redirect()->route('hardware.index') return redirect()->route('hardware.index')
->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', $asset->id), 'id', 'tag' => e($asset->asset_tag)])); ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', $asset->id), 'id', 'tag' => e($asset->asset_tag)]));

View file

@ -5,7 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class ForgotPasswordController extends Controller class ForgotPasswordController extends Controller
{ {
/* /*
@ -79,16 +79,16 @@ class ForgotPasswordController extends Controller
) )
); );
} catch(\Exception $e) { } catch(\Exception $e) {
\Log::info('Password reset attempt: User '.$request->input('username').'failed with exception: '.$e ); Log::info('Password reset attempt: User '.$request->input('username').'failed with exception: '.$e );
} }
// Prevent timing attack to enumerate users. // Prevent timing attack to enumerate users.
usleep(500000 + random_int(0, 1500000)); usleep(500000 + random_int(0, 1500000));
if ($response === \Password::RESET_LINK_SENT) { if ($response === \Password::RESET_LINK_SENT) {
\Log::info('Password reset attempt: User '.$request->input('username').' WAS found, password reset sent'); Log::info('Password reset attempt: User '.$request->input('username').' WAS found, password reset sent');
} else { } else {
\Log::info('Password reset attempt: User matching username '.$request->input('username').' NOT FOUND or user is inactive'); Log::info('Password reset attempt: User matching username '.$request->input('username').' NOT FOUND or user is inactive');
} }
/** /**

View file

@ -16,7 +16,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Log; use Illuminate\Support\Facades\Log;
use Redirect; use Redirect;
/** /**
@ -122,7 +122,7 @@ class LoginController extends Controller
Auth::login($user); Auth::login($user);
} else { } else {
$username = $saml->getUsername(); $username = $saml->getUsername();
\Log::debug("SAML user '$username' could not be found in database."); Log::debug("SAML user '$username' could not be found in database.");
$request->session()->flash('error', trans('auth/message.signin.error')); $request->session()->flash('error', trans('auth/message.signin.error'));
$saml->clearData(); $saml->clearData();
} }
@ -137,7 +137,7 @@ class LoginController extends Controller
$s->save(); $s->save();
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('There was an error authenticating the SAML user: '.$e->getMessage()); Log::debug('There was an error authenticating the SAML user: '.$e->getMessage());
throw $e; throw $e;
} }
@ -146,7 +146,7 @@ class LoginController extends Controller
// Better logging // Better logging
if (empty($samlData)) { if (empty($samlData)) {
\Log::debug("SAML page requested, but samlData seems empty."); Log::debug("SAML page requested, but samlData seems empty.");
} }
} }
@ -268,12 +268,12 @@ class LoginController extends Controller
//If the environment is set to ALWAYS require SAML, return access denied //If the environment is set to ALWAYS require SAML, return access denied
if (config('app.require_saml')) { if (config('app.require_saml')) {
\Log::debug('require SAML is enabled in the .env - return a 403'); Log::debug('require SAML is enabled in the .env - return a 403');
return view('errors.403'); return view('errors.403');
} }
if (Setting::getSettings()->login_common_disabled == '1') { if (Setting::getSettings()->login_common_disabled == '1') {
\Log::debug('login_common_disabled is set to 1 - return a 403'); Log::debug('login_common_disabled is set to 1 - return a 403');
return view('errors.403'); return view('errors.403');
} }
@ -451,7 +451,7 @@ class LoginController extends Controller
* *
* @param Request $request * @param Request $request
* *
* @return Redirect * @return Illuminate\Http\RedirectResponse
*/ */
public function logout(Request $request) public function logout(Request $request)
{ {

View file

@ -7,7 +7,7 @@ use App\Models\Setting;
use App\Models\User; use App\Models\User;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class ResetPasswordController extends Controller class ResetPasswordController extends Controller
{ {
@ -66,7 +66,7 @@ class ResetPasswordController extends Controller
$credentials = $request->only('email', 'token'); $credentials = $request->only('email', 'token');
if (is_null($this->broker()->getUser($credentials))) { if (is_null($this->broker()->getUser($credentials))) {
\Log::debug('Password reset form FAILED - this token is not valid.'); Log::debug('Password reset form FAILED - this token is not valid.');
return redirect()->route('password.request')->with('error', trans('passwords.token')); return redirect()->route('password.request')->with('error', trans('passwords.token'));
} }
@ -89,10 +89,10 @@ class ResetPasswordController extends Controller
$request->validate($this->rules(), $request->all(), $this->validationErrorMessages()); $request->validate($this->rules(), $request->all(), $this->validationErrorMessages());
\Log::debug('Checking if '.$request->input('username').' exists'); Log::debug('Checking if '.$request->input('username').' exists');
// Check to see if the user even exists - we'll treat the response the same to prevent user sniffing // Check to see if the user even exists - we'll treat the response the same to prevent user sniffing
if ($user = User::where('username', '=', $request->input('username'))->where('activated', '1')->whereNotNull('email')->first()) { if ($user = User::where('username', '=', $request->input('username'))->where('activated', '1')->whereNotNull('email')->first()) {
\Log::debug($user->username.' exists'); Log::debug($user->username.' exists');
// handle the password validation rules set by the admin settings // handle the password validation rules set by the admin settings
@ -112,17 +112,17 @@ class ResetPasswordController extends Controller
// Check if the password reset above actually worked // Check if the password reset above actually worked
if ($response == \Password::PASSWORD_RESET) { if ($response == \Password::PASSWORD_RESET) {
\Log::debug('Password reset for '.$user->username.' worked'); Log::debug('Password reset for '.$user->username.' worked');
return redirect()->guest('login')->with('success', trans('passwords.reset')); return redirect()->guest('login')->with('success', trans('passwords.reset'));
} }
\Log::debug('Password reset for '.$user->username.' FAILED - this user exists but the token is not valid'); Log::debug('Password reset for '.$user->username.' FAILED - this user exists but the token is not valid');
return redirect()->back()->withInput($request->only('email'))->with('success', trans('passwords.reset')); return redirect()->back()->withInput($request->only('email'))->with('success', trans('passwords.reset'));
} }
\Log::debug('Password reset for '.$request->input('username').' FAILED - user does not exist or does not have an email address - but make it look like it succeeded'); Log::debug('Password reset for '.$request->input('username').' FAILED - user does not exist or does not have an email address - but make it look like it succeeded');
return redirect()->guest('login')->with('success', trans('passwords.reset')); return redirect()->guest('login')->with('success', trans('passwords.reset'));
} }

View file

@ -5,7 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\Saml; use App\Services\Saml;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Log; use Illuminate\Support\Facades\Log;
/** /**
* This controller provides the endpoint for SAML communication and metadata. * This controller provides the endpoint for SAML communication and metadata.
@ -51,7 +51,7 @@ class SamlController extends Controller
$metadata = $this->saml->getSPMetadata(); $metadata = $this->saml->getSPMetadata();
if (empty($metadata)) { if (empty($metadata)) {
\Log::debug('SAML metadata is empty - return a 403'); Log::debug('SAML metadata is empty - return a 403');
return response()->view('errors.403', [], 403); return response()->view('errors.403', [], 403);
} }

View file

@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use App\Models\Category as Category; use App\Models\Category as Category;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Str; use Str;

View file

@ -6,6 +6,7 @@ use App\Http\Requests\ImageUploadRequest;
use App\Models\Company; use App\Models\Company;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
/** /**
* This controller handles all actions related to Companies for * This controller handles all actions related to Companies for
@ -154,7 +155,7 @@ final class CompaniesController extends Controller
try { try {
Storage::disk('public')->delete('companies'.'/'.$company->image); Storage::disk('public')->delete('companies'.'/'.$company->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }

View file

@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Log;
/** /**
* This class controls all actions related to Components for * This class controls all actions related to Components for
@ -188,7 +189,7 @@ class ComponentsController extends Controller
try { try {
Storage::disk('public')->delete('components/'.$component->image); Storage::disk('public')->delete('components/'.$component->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }

View file

@ -10,6 +10,7 @@ use App\Models\Component;
use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Illuminate\Support\Facades\Log;
class ComponentsFilesController extends Controller class ComponentsFilesController extends Controller
{ {
@ -84,7 +85,7 @@ class ComponentsFilesController extends Controller
try { try {
Storage::delete('components/'.$log->filename); Storage::delete('components/'.$log->filename);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
@ -110,7 +111,7 @@ class ComponentsFilesController extends Controller
*/ */
public function show($componentId = null, $fileId = null) public function show($componentId = null, $fileId = null)
{ {
\Log::debug('Private filesystem is: '.config('filesystems.default')); Log::debug('Private filesystem is: '.config('filesystems.default'));
$component = Component::find($componentId); $component = Component::find($componentId);
// the component is valid // the component is valid
@ -126,8 +127,8 @@ class ComponentsFilesController extends Controller
$file = 'private_uploads/components/'.$log->filename; $file = 'private_uploads/components/'.$log->filename;
if (Storage::missing($file)) { if (Storage::missing($file)) {
\Log::debug('FILE DOES NOT EXISTS for '.$file); Log::debug('FILE DOES NOT EXISTS for '.$file);
\Log::debug('URL should be '.Storage::url($file)); Log::debug('URL should be '.Storage::url($file));
return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) return response('File '.$file.' ('.Storage::url($file).') not found on server', 404)
->header('Content-Type', 'text/plain'); ->header('Content-Type', 'text/plain');

View file

@ -10,7 +10,7 @@ use App\Models\Consumable;
use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Symfony\Consumable\HttpFoundation\JsonResponse; use Symfony\Consumable\HttpFoundation\JsonResponse;
use Illuminate\Support\Facades\Log;
class ConsumablesFilesController extends Controller class ConsumablesFilesController extends Controller
{ {
/** /**
@ -83,7 +83,7 @@ class ConsumablesFilesController extends Controller
try { try {
Storage::delete('consumables/'.$log->filename); Storage::delete('consumables/'.$log->filename);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
@ -124,8 +124,8 @@ class ConsumablesFilesController extends Controller
$file = 'private_uploads/consumables/'.$log->filename; $file = 'private_uploads/consumables/'.$log->filename;
if (Storage::missing($file)) { if (Storage::missing($file)) {
\Log::debug('FILE DOES NOT EXISTS for '.$file); Log::debug('FILE DOES NOT EXISTS for '.$file);
\Log::debug('URL should be '.Storage::url($file)); Log::debug('URL should be '.Storage::url($file));
return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) return response('File '.$file.' ('.Storage::url($file).') not found on server', 404)
->header('Content-Type', 'text/plain'); ->header('Content-Type', 'text/plain');

View file

@ -22,7 +22,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;

View file

@ -8,7 +8,6 @@ use App\Models\CustomField;
use App\Models\CustomFieldset; use App\Models\CustomFieldset;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Redirect;
/** /**
* This controller handles all actions related to Custom Asset Fields for * This controller handles all actions related to Custom Asset Fields for

View file

@ -7,6 +7,7 @@ use App\Models\Department;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
class DepartmentsController extends Controller class DepartmentsController extends Controller
{ {
@ -129,7 +130,7 @@ class DepartmentsController extends Controller
try { try {
Storage::disk('public')->delete('departments'.'/'.$department->image); Storage::disk('public')->delete('departments'.'/'.$department->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
$department->delete(); $department->delete();

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Auth;
use Laravel\Socialite\Facades\Socialite; use Laravel\Socialite\Facades\Socialite;
use Laravel\Socialite\Two\InvalidStateException; use Laravel\Socialite\Two\InvalidStateException;
use App\Models\Setting; use App\Models\Setting;
use Illuminate\Support\Facades\Log;
class GoogleAuthController extends Controller class GoogleAuthController extends Controller
{ {
@ -34,9 +34,9 @@ class GoogleAuthController extends Controller
{ {
try { try {
$socialUser = Socialite::driver('google')->user(); $socialUser = Socialite::driver('google')->user();
\Log::debug('Google user found in Google Workspace'); Log::debug('Google user found in Google Workspace');
} catch (InvalidStateException $exception) { } catch (InvalidStateException $exception) {
\Log::debug('Google user NOT found in Google Workspace'); Log::debug('Google user NOT found in Google Workspace');
return redirect()->route('login') return redirect()->route('login')
->withErrors( ->withErrors(
[ [
@ -52,7 +52,7 @@ class GoogleAuthController extends Controller
if ($user) { if ($user) {
\Log::debug('Google user '.$socialUser->getEmail().' found in Snipe-IT'); Log::debug('Google user '.$socialUser->getEmail().' found in Snipe-IT');
$user->update([ $user->update([
'avatar' => $socialUser->avatar, 'avatar' => $socialUser->avatar,
]); ]);
@ -61,7 +61,7 @@ class GoogleAuthController extends Controller
return redirect()->route('home'); return redirect()->route('home');
} }
\Log::debug('Google user '.$socialUser->getEmail().' NOT found in Snipe-IT'); Log::debug('Google user '.$socialUser->getEmail().' NOT found in Snipe-IT');
return redirect()->route('login') return redirect()->route('login')
->withErrors( ->withErrors(
[ [

View file

@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Models\Group; use App\Models\Group;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Auth; use Illuminate\Support\Facades\Auth;
/** /**
* This controller handles all actions related to User Groups for * This controller handles all actions related to User Groups for

View file

@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Log;
class LicenseCheckinController extends Controller class LicenseCheckinController extends Controller
{ {
@ -145,7 +146,7 @@ class LicenseCheckinController extends Controller
$user_seat->assigned_to = null; $user_seat->assigned_to = null;
if ($user_seat->save()) { if ($user_seat->save()) {
\Log::debug('Checking in '.$license->name.' from user '.$user_seat->username); Log::debug('Checking in '.$license->name.' from user '.$user_seat->username);
$user_seat->logCheckin($user_seat->user, trans('admin/licenses/general.bulk.checkin_all.log_msg')); $user_seat->logCheckin($user_seat->user, trans('admin/licenses/general.bulk.checkin_all.log_msg'));
} }
} }
@ -160,7 +161,7 @@ class LicenseCheckinController extends Controller
$asset_seat->asset_id = null; $asset_seat->asset_id = null;
if ($asset_seat->save()) { if ($asset_seat->save()) {
\Log::debug('Checking in '.$license->name.' from asset '.$asset_seat->asset_tag); Log::debug('Checking in '.$license->name.' from asset '.$asset_seat->asset_tag);
$asset_seat->logCheckin($asset_seat->asset, trans('admin/licenses/general.bulk.checkin_all.log_msg')); $asset_seat->logCheckin($asset_seat->asset, trans('admin/licenses/general.bulk.checkin_all.log_msg'));
$count++; $count++;
} }

View file

@ -11,6 +11,7 @@ use App\Models\License;
use App\Models\LicenseSeat; use App\Models\LicenseSeat;
use App\Models\User; use App\Models\User;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class LicenseCheckoutController extends Controller class LicenseCheckoutController extends Controller
{ {
@ -155,16 +156,16 @@ class LicenseCheckoutController extends Controller
public function bulkCheckout($licenseId) { public function bulkCheckout($licenseId) {
\Log::debug('Checking out '.$licenseId.' via bulk'); Log::debug('Checking out '.$licenseId.' via bulk');
$license = License::findOrFail($licenseId); $license = License::findOrFail($licenseId);
$this->authorize('checkin', $license); $this->authorize('checkin', $license);
$avail_count = $license->getAvailSeatsCountAttribute(); $avail_count = $license->getAvailSeatsCountAttribute();
$users = User::whereNull('deleted_at')->where('autoassign_licenses', '=', 1)->with('licenses')->get(); $users = User::whereNull('deleted_at')->where('autoassign_licenses', '=', 1)->with('licenses')->get();
\Log::debug($avail_count.' will be assigned'); Log::debug($avail_count.' will be assigned');
if ($users->count() > $avail_count) { if ($users->count() > $avail_count) {
\Log::debug('You do not have enough free seats to complete this task, so we will check out as many as we can. '); Log::debug('You do not have enough free seats to complete this task, so we will check out as many as we can. ');
} }
// If the license is valid, check that there is an available seat // If the license is valid, check that there is an available seat
@ -179,7 +180,7 @@ class LicenseCheckoutController extends Controller
// Check to make sure this user doesn't already have this license checked out to them // Check to make sure this user doesn't already have this license checked out to them
if ($user->licenses->where('id', '=', $licenseId)->count()) { if ($user->licenses->where('id', '=', $licenseId)->count()) {
\Log::debug($user->username.' already has this license checked out to them. Skipping... '); Log::debug($user->username.' already has this license checked out to them. Skipping... ');
continue; continue;
} }
@ -192,7 +193,7 @@ class LicenseCheckoutController extends Controller
$avail_count--; $avail_count--;
$assigned_count++; $assigned_count++;
$licenseSeat->logCheckout(trans('admin/licenses/general.bulk.checkout_all.log_msg'), $user); $licenseSeat->logCheckout(trans('admin/licenses/general.bulk.checkout_all.log_msg'), $user);
\Log::debug('License '.$license->name.' seat '.$licenseSeat->id.' checked out to '.$user->username); Log::debug('License '.$license->name.' seat '.$licenseSeat->id.' checked out to '.$user->username);
} }
if ($avail_count == 0) { if ($avail_count == 0) {

View file

@ -7,9 +7,8 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\UploadFileRequest; use App\Http\Requests\UploadFileRequest;
use App\Models\Actionlog; use App\Models\Actionlog;
use App\Models\License; use App\Models\License;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\JsonResponse; use Illuminate\Support\Facades\Log;
class LicenseFilesController extends Controller class LicenseFilesController extends Controller
{ {
@ -20,7 +19,7 @@ class LicenseFilesController extends Controller
* @param int $licenseId * @param int $licenseId
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Illuminate\Auth\Access\AuthorizationException
*@author [A. Gianotto] [<snipe@snipe.net>] * @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0] * @since [v1.0]
* @todo Switch to using the AssetFileRequest form request validator. * @todo Switch to using the AssetFileRequest form request validator.
*/ */
@ -78,7 +77,7 @@ class LicenseFilesController extends Controller
try { try {
Storage::delete('licenses/'.$log->filename); Storage::delete('licenses/'.$log->filename);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
@ -121,8 +120,8 @@ class LicenseFilesController extends Controller
$file = 'private_uploads/licenses/'.$log->filename; $file = 'private_uploads/licenses/'.$log->filename;
if (Storage::missing($file)) { if (Storage::missing($file)) {
\Log::debug('NOT EXISTS for '.$file); Log::debug('NOT EXISTS for '.$file);
\Log::debug('NOT EXISTS URL should be '.Storage::url($file)); Log::debug('NOT EXISTS URL should be '.Storage::url($file));
return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) return response('File '.$file.' ('.Storage::url($file).') not found on server', 404)
->header('Content-Type', 'text/plain'); ->header('Content-Type', 'text/plain');

View file

@ -9,6 +9,7 @@ use App\Models\User;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
/** /**
* This controller handles all actions related to Locations for * This controller handles all actions related to Locations for
@ -186,7 +187,7 @@ class LocationsController extends Controller
try { try {
Storage::disk('public')->delete('locations/'.$location->image); Storage::disk('public')->delete('locations/'.$location->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::error($e); Log::error($e);
} }
} }
$location->delete(); $location->delete();
@ -341,8 +342,8 @@ class LocationsController extends Controller
} }
} }
\Log::debug('Success count: '.$success_count); Log::debug('Success count: '.$success_count);
\Log::debug('Error count: '.$error_count); Log::debug('Error count: '.$error_count);
// Complete success // Complete success
if ($success_count == count($locations_raw_array)) { if ($success_count == count($locations_raw_array)) {
return redirect() return redirect()

View file

@ -12,6 +12,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Redirect; use Redirect;
use Illuminate\Support\Facades\Log;
/** /**
* This controller handles all actions related to Manufacturers for * This controller handles all actions related to Manufacturers for
@ -174,7 +175,7 @@ class ManufacturersController extends Controller
try { try {
Storage::disk('public')->delete('manufacturers/'.$manufacturer->image); Storage::disk('public')->delete('manufacturers/'.$manufacturer->image);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::info($e); Log::info($e);
} }
} }

View file

@ -3,7 +3,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\ImageUploadRequest;
use App\Models\Asset;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use App\Notifications\CurrentInventory; use App\Notifications\CurrentInventory;
@ -11,10 +10,6 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Image;
use Redirect;
use View;
/** /**
* This controller handles all actions related to User Profiles for * This controller handles all actions related to User Profiles for

View file

@ -24,6 +24,7 @@ use League\Csv\Reader;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
use League\Csv\EscapeFormula; use League\Csv\EscapeFormula;
use App\Http\Requests\CustomAssetReportRequest; use App\Http\Requests\CustomAssetReportRequest;
use Illuminate\Support\Facades\Log;
/** /**
@ -235,7 +236,7 @@ class ReportsController extends Controller
\Debugbar::disable(); \Debugbar::disable();
$response = new StreamedResponse(function () { $response = new StreamedResponse(function () {
\Log::debug('Starting streamed response'); Log::debug('Starting streamed response');
// Open output stream // Open output stream
$handle = fopen('php://output', 'w'); $handle = fopen('php://output', 'w');
@ -259,16 +260,16 @@ class ReportsController extends Controller
]; ];
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Starting headers: '.$executionTime); Log::debug('Starting headers: '.$executionTime);
fputcsv($handle, $header); fputcsv($handle, $header);
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Added headers: '.$executionTime); Log::debug('Added headers: '.$executionTime);
$actionlogs = Actionlog::with('item', 'user', 'target', 'location') $actionlogs = Actionlog::with('item', 'user', 'target', 'location')
->orderBy('created_at', 'DESC') ->orderBy('created_at', 'DESC')
->chunk(20, function ($actionlogs) use ($handle) { ->chunk(20, function ($actionlogs) use ($handle) {
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Walking results: '.$executionTime); Log::debug('Walking results: '.$executionTime);
$count = 0; $count = 0;
foreach ($actionlogs as $actionlog) { foreach ($actionlogs as $actionlog) {
@ -312,7 +313,7 @@ class ReportsController extends Controller
// Close the output stream // Close the output stream
fclose($handle); fclose($handle);
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('-- SCRIPT COMPLETED IN '.$executionTime); Log::debug('-- SCRIPT COMPLETED IN '.$executionTime);
}, 200, [ }, 200, [
'Content-Type' => 'text/csv', 'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="activity-report-'.date('Y-m-d-his').'.csv"', 'Content-Disposition' => 'attachment; filename="activity-report-'.date('Y-m-d-his').'.csv"',
@ -425,8 +426,8 @@ class ReportsController extends Controller
\Debugbar::disable(); \Debugbar::disable();
$customfields = CustomField::get(); $customfields = CustomField::get();
$response = new StreamedResponse(function () use ($customfields, $request) { $response = new StreamedResponse(function () use ($customfields, $request) {
\Log::debug('Starting streamed response'); Log::debug('Starting streamed response');
\Log::debug('CSV escaping is set to: '.config('app.escape_formulas')); Log::debug('CSV escaping is set to: '.config('app.escape_formulas'));
// Open output stream // Open output stream
$handle = fopen('php://output', 'w'); $handle = fopen('php://output', 'w');
@ -627,10 +628,10 @@ class ReportsController extends Controller
} }
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Starting headers: '.$executionTime); Log::debug('Starting headers: '.$executionTime);
fputcsv($handle, $header); fputcsv($handle, $header);
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Added headers: '.$executionTime); Log::debug('Added headers: '.$executionTime);
$assets = Asset::select('assets.*')->with( $assets = Asset::select('assets.*')->with(
'location', 'assetstatus', 'company', 'defaultLoc', 'assignedTo', 'location', 'assetstatus', 'company', 'defaultLoc', 'assignedTo',
@ -732,11 +733,11 @@ class ReportsController extends Controller
$assets->onlyTrashed(); $assets->onlyTrashed();
} }
\Log::debug($assets->toSql()); Log::debug($assets->toSql());
$assets->orderBy('assets.id', 'ASC')->chunk(20, function ($assets) use ($handle, $customfields, $request) { $assets->orderBy('assets.id', 'ASC')->chunk(20, function ($assets) use ($handle, $customfields, $request) {
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('Walking results: '.$executionTime); Log::debug('Walking results: '.$executionTime);
$count = 0; $count = 0;
$formatter = new EscapeFormula("`"); $formatter = new EscapeFormula("`");
@ -996,14 +997,14 @@ class ReportsController extends Controller
} }
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('-- Record '.$count.' Asset ID:'.$asset->id.' in '.$executionTime); Log::debug('-- Record '.$count.' Asset ID:'.$asset->id.' in '.$executionTime);
} }
}); });
// Close the output stream // Close the output stream
fclose($handle); fclose($handle);
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
\Log::debug('-- SCRIPT COMPLETED IN '.$executionTime); Log::debug('-- SCRIPT COMPLETED IN '.$executionTime);
}, 200, [ }, 200, [
'Content-Type' => 'text/csv', 'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="custom-assets-report-'.date('Y-m-d-his').'.csv"', 'Content-Disposition' => 'attachment; filename="custom-assets-report-'.date('Y-m-d-his').'.csv"',
@ -1141,23 +1142,23 @@ class ReportsController extends Controller
$this->authorize('reports.view'); $this->authorize('reports.view');
if (!$acceptance = CheckoutAcceptance::pending()->find($request->input('acceptance_id'))) { if (!$acceptance = CheckoutAcceptance::pending()->find($request->input('acceptance_id'))) {
\Log::debug('No pending acceptances'); Log::debug('No pending acceptances');
// Redirect to the unaccepted assets report page with error // Redirect to the unaccepted assets report page with error
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data'));
} }
$assetItem = $acceptance->checkoutable; $assetItem = $acceptance->checkoutable;
\Log::debug(print_r($assetItem, true)); Log::debug(print_r($assetItem, true));
if (is_null($acceptance->created_at)){ if (is_null($acceptance->created_at)){
\Log::debug('No acceptance created_at'); Log::debug('No acceptance created_at');
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data'));
} else { } else {
$logItem_res = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get(); $logItem_res = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get();
if ($logItem_res->isEmpty()){ if ($logItem_res->isEmpty()){
\Log::debug('Acceptance date mismatch'); Log::debug('Acceptance date mismatch');
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data'));
} }
$logItem = $logItem_res[0]; $logItem = $logItem_res[0];

View file

@ -19,6 +19,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Password; use Illuminate\Support\Facades\Password;
use Illuminate\Support\Facades\Log;
class BulkUsersController extends Controller class BulkUsersController extends Controller
{ {
@ -323,18 +324,18 @@ class BulkUsersController extends Controller
foreach ($users_to_merge as $user_to_merge) { foreach ($users_to_merge as $user_to_merge) {
foreach ($user_to_merge->assets as $asset) { foreach ($user_to_merge->assets as $asset) {
\Log::debug('Updating asset: '.$asset->asset_tag . ' to '.$merge_into_user->id); Log::debug('Updating asset: '.$asset->asset_tag . ' to '.$merge_into_user->id);
$asset->assigned_to = $request->input('merge_into_id'); $asset->assigned_to = $request->input('merge_into_id');
$asset->save(); $asset->save();
} }
foreach ($user_to_merge->licenses as $license) { foreach ($user_to_merge->licenses as $license) {
\Log::debug('Updating license pivot: '.$license->id . ' to '.$merge_into_user->id); Log::debug('Updating license pivot: '.$license->id . ' to '.$merge_into_user->id);
$user_to_merge->licenses()->updateExistingPivot($license->id, ['assigned_to' => $merge_into_user->id]); $user_to_merge->licenses()->updateExistingPivot($license->id, ['assigned_to' => $merge_into_user->id]);
} }
foreach ($user_to_merge->consumables as $consumable) { foreach ($user_to_merge->consumables as $consumable) {
\Log::debug('Updating consumable pivot: '.$consumable->id . ' to '.$merge_into_user->id); Log::debug('Updating consumable pivot: '.$consumable->id . ' to '.$merge_into_user->id);
$user_to_merge->consumables()->updateExistingPivot($consumable->id, ['assigned_to' => $merge_into_user->id]); $user_to_merge->consumables()->updateExistingPivot($consumable->id, ['assigned_to' => $merge_into_user->id]);
} }

View file

@ -14,7 +14,7 @@ use App\Models\Group;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use App\Notifications\WelcomeNotification; use App\Notifications\WelcomeNotification;
use Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password; use Illuminate\Support\Facades\Password;

View file

@ -8,7 +8,7 @@ use Livewire\Component;
use App\Models\Import; use App\Models\Import;
use Storage; use Storage;
use Log; use Illuminate\Support\Facades\Log;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
@ -119,8 +119,8 @@ class Importer extends Component
public function updating($name, $new_import_type) public function updating($name, $new_import_type)
{ {
if ($name == "activeFile.import_type") { if ($name == "activeFile.import_type") {
\Log::debug("WE ARE CHANGING THE import_type!!!!! TO: " . $new_import_type); Log::debug("WE ARE CHANGING THE import_type!!!!! TO: " . $new_import_type);
\Log::debug("so, what's \$this->>field_map at?: " . print_r($this->field_map, true)); Log::debug("so, what's \$this->>field_map at?: " . print_r($this->field_map, true));
// go through each header, find a matching field to try and map it to. // go through each header, find a matching field to try and map it to.
foreach ($this->activeFile->header_row as $i => $header) { foreach ($this->activeFile->header_row as $i => $header) {
// do we have something mapped already? // do we have something mapped already?
@ -523,7 +523,7 @@ class Importer extends Component
{ {
// TODO: why don't we just do File::find($id)? This seems dumb. // TODO: why don't we just do File::find($id)? This seems dumb.
foreach($this->files as $file) { foreach($this->files as $file) {
\Log::debug("File id is: ".$file->id); Log::debug("File id is: ".$file->id);
if($id == $file->id) { if($id == $file->id) {
if(Storage::delete('private_uploads/imports/'.$file->file_path)) { if(Storage::delete('private_uploads/imports/'.$file->file_path)) {
$file->delete(); $file->delete();

View file

@ -2,6 +2,7 @@
namespace App\Http\Livewire; namespace App\Http\Livewire;
use Livewire\Component; use Livewire\Component;
use Illuminate\Support\Facades\Log;
class LoginForm extends Component class LoginForm extends Component
{ {
@ -39,13 +40,12 @@ class LoginForm extends Component
} }
$whatever = $this->validateOnly($fields); $whatever = $this->validateOnly($fields);
//\Log::info(print_r($whatever,true));
$errors = $this->getErrorBag(); $errors = $this->getErrorBag();
$this->can_submit = $this->username !== "" && $this->password !== "" && !$errors->has('username') && !$errors->has('password') ; // wait, what? $this->can_submit = $this->username !== "" && $this->password !== "" && !$errors->has('username') && !$errors->has('password') ; // wait, what?
\Log::info("Oy - can we submit yet?!".$this->can_submit); Log::info("Oy - can we submit yet?!".$this->can_submit);
} }
/** /**

View file

@ -3,10 +3,9 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use App\Models\Asset; use App\Models\Asset;
use Auth;
use Closure; use Closure;
use App\Models\Setting; use App\Models\Setting;
use Illuminate\Support\Facades\Log;
class AssetCountForSidebar class AssetCountForSidebar
{ {
/** /**
@ -31,7 +30,7 @@ class AssetCountForSidebar
$settings = Setting::getSettings(); $settings = Setting::getSettings();
view()->share('settings', $settings); view()->share('settings', $settings);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
@ -41,77 +40,77 @@ class AssetCountForSidebar
} }
view()->share('total_assets', $total_assets); view()->share('total_assets', $total_assets);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_rtd_sidebar = Asset::RTD()->count(); $total_rtd_sidebar = Asset::RTD()->count();
view()->share('total_rtd_sidebar', $total_rtd_sidebar); view()->share('total_rtd_sidebar', $total_rtd_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_deployed_sidebar = Asset::Deployed()->count(); $total_deployed_sidebar = Asset::Deployed()->count();
view()->share('total_deployed_sidebar', $total_deployed_sidebar); view()->share('total_deployed_sidebar', $total_deployed_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_archived_sidebar = Asset::Archived()->count(); $total_archived_sidebar = Asset::Archived()->count();
view()->share('total_archived_sidebar', $total_archived_sidebar); view()->share('total_archived_sidebar', $total_archived_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_pending_sidebar = Asset::Pending()->count(); $total_pending_sidebar = Asset::Pending()->count();
view()->share('total_pending_sidebar', $total_pending_sidebar); view()->share('total_pending_sidebar', $total_pending_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_undeployable_sidebar = Asset::Undeployable()->count(); $total_undeployable_sidebar = Asset::Undeployable()->count();
view()->share('total_undeployable_sidebar', $total_undeployable_sidebar); view()->share('total_undeployable_sidebar', $total_undeployable_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_byod_sidebar = Asset::where('byod', '=', '1')->count(); $total_byod_sidebar = Asset::where('byod', '=', '1')->count();
view()->share('total_byod_sidebar', $total_byod_sidebar); view()->share('total_byod_sidebar', $total_byod_sidebar);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_due_for_audit = Asset::DueForAudit($settings)->count(); $total_due_for_audit = Asset::DueForAudit($settings)->count();
view()->share('total_due_for_audit', $total_due_for_audit); view()->share('total_due_for_audit', $total_due_for_audit);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_overdue_for_audit = Asset::OverdueForAudit()->count(); $total_overdue_for_audit = Asset::OverdueForAudit()->count();
view()->share('total_overdue_for_audit', $total_overdue_for_audit); view()->share('total_overdue_for_audit', $total_overdue_for_audit);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_due_for_checkin = Asset::DueForCheckin($settings)->count(); $total_due_for_checkin = Asset::DueForCheckin($settings)->count();
view()->share('total_due_for_checkin', $total_due_for_checkin); view()->share('total_due_for_checkin', $total_due_for_checkin);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
try { try {
$total_overdue_for_checkin = Asset::OverdueForCheckin()->count(); $total_overdue_for_checkin = Asset::OverdueForCheckin()->count();
view()->share('total_overdue_for_checkin', $total_overdue_for_checkin); view()->share('total_overdue_for_checkin', $total_overdue_for_checkin);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
view()->share('total_due_and_overdue_for_checkin', ($total_due_for_checkin + $total_overdue_for_checkin)); view()->share('total_due_and_overdue_for_checkin', ($total_due_for_checkin + $total_overdue_for_checkin));

View file

@ -2,7 +2,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Auth; use Illuminate\Support\Facades\Auth;
use Closure; use Closure;
class CheckForDebug class CheckForDebug

View file

@ -3,7 +3,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use App\Models\Setting; use App\Models\Setting;
use Auth; use Illuminate\Support\Facades\Auth;
use Closure; use Closure;
class CheckForTwoFactor class CheckForTwoFactor

View file

@ -5,13 +5,13 @@ namespace App\Http\Middleware;
use App\Models\Setting; use App\Models\Setting;
use Closure; use Closure;
use \App\Helpers\Helper; use \App\Helpers\Helper;
use Illuminate\Support\Facades\Log;
class CheckLocale class CheckLocale
{ {
private function warn_legacy_locale($language, $source) private function warn_legacy_locale($language, $source)
{ {
if ($language != Helper::mapLegacyLocale($language)) { if ($language != Helper::mapLegacyLocale($language)) {
\Log::warning("$source $language and should be updated to be ".Helper::mapLegacyLocale($language)); Log::warning("$source $language and should be updated to be ".Helper::mapLegacyLocale($language));
} }
} }
/** /**

View file

@ -4,7 +4,7 @@ namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Auth; use Illuminate\Support\Facades\Auth;
class CheckUserIsActivated class CheckUserIsActivated
{ {

View file

@ -9,7 +9,7 @@ use App\Http\Traits\ConvertsBase64ToFiles;
use Illuminate\Http\UploadedFile; use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Intervention\Image\Exception\NotReadableException; use Intervention\Image\Exception\NotReadableException;
use Illuminate\Support\Facades\Log;
class ImageUploadRequest extends Request class ImageUploadRequest extends Request
{ {
@ -97,8 +97,8 @@ class ImageUploadRequest extends Request
$ext = $image->guessExtension(); $ext = $image->guessExtension();
$file_name = $type.'-'.$form_fieldname.'-'.$item->id.'-'.str_random(10).'.'.$ext; $file_name = $type.'-'.$form_fieldname.'-'.$item->id.'-'.str_random(10).'.'.$ext;
\Log::info('File name will be: '.$file_name); Log::info('File name will be: '.$file_name);
\Log::debug('File extension is: '.$ext); Log::debug('File extension is: '.$ext);
if (($image->getMimeType() == 'image/vnd.microsoft.icon') || ($image->getMimeType() == 'image/x-icon') || ($image->getMimeType() == 'image/avif') || ($image->getMimeType() == 'image/webp')) { if (($image->getMimeType() == 'image/vnd.microsoft.icon') || ($image->getMimeType() == 'image/x-icon') || ($image->getMimeType() == 'image/avif') || ($image->getMimeType() == 'image/webp')) {
// If the file is an icon, webp or avif, we need to just move it since gd doesn't support resizing // If the file is an icon, webp or avif, we need to just move it since gd doesn't support resizing
@ -114,7 +114,7 @@ class ImageUploadRequest extends Request
try { try {
Storage::disk('public')->put($path . '/' . $file_name, $cleanSVG); Storage::disk('public')->put($path . '/' . $file_name, $cleanSVG);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} else { } else {
@ -125,7 +125,7 @@ class ImageUploadRequest extends Request
})->orientate(); })->orientate();
} catch(NotReadableException $e) { } catch(NotReadableException $e) {
\Log::debug($e); Log::debug($e);
$validator = \Validator::make([], []); $validator = \Validator::make([], []);
$validator->errors()->add($form_fieldname, trans('general.unaccepted_image_type', ['mimetype' => $image->getClientMimeType()])); $validator->errors()->add($form_fieldname, trans('general.unaccepted_image_type', ['mimetype' => $image->getClientMimeType()]));
@ -142,7 +142,7 @@ class ImageUploadRequest extends Request
try { try {
Storage::disk('public')->delete($path.'/'.$item->{$form_fieldname}); Storage::disk('public')->delete($path.'/'.$item->{$form_fieldname});
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Could not delete old file. '.$path.'/'.$file_name.' does not exist?'); Log::debug('Could not delete old file. '.$path.'/'.$file_name.' does not exist?');
} }
} }
@ -152,12 +152,12 @@ class ImageUploadRequest extends Request
// If the user isn't uploading anything new but wants to delete their old image, do so // If the user isn't uploading anything new but wants to delete their old image, do so
} elseif ($this->input('image_delete') == '1') { } elseif ($this->input('image_delete') == '1') {
\Log::debug('Deleting image'); Log::debug('Deleting image');
try { try {
Storage::disk('public')->delete($path.'/'.$item->{$db_fieldname}); Storage::disk('public')->delete($path.'/'.$item->{$db_fieldname});
$item->{$db_fieldname} = null; $item->{$db_fieldname} = null;
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }

View file

@ -5,6 +5,7 @@ namespace App\Http\Requests;
use App\Models\Import; use App\Models\Import;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class ItemImportRequest extends FormRequest class ItemImportRequest extends FormRequest
{ {
@ -71,7 +72,7 @@ class ItemImportRequest extends FormRequest
public function log($string) public function log($string)
{ {
\Log::Info($string); Log::Info($string);
} }
public function progress($count) public function progress($count)

View file

@ -4,6 +4,7 @@ namespace App\Http\Requests;
use enshrined\svgSanitize\Sanitizer; use enshrined\svgSanitize\Sanitizer;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
class UploadFileRequest extends Request class UploadFileRequest extends Request
{ {
@ -44,11 +45,11 @@ class UploadFileRequest extends Request
$file_name = $name_prefix.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$file->guessExtension(); $file_name = $name_prefix.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$file->guessExtension();
\Log::debug("Your filetype IS: ".$file->getMimeType()); Log::debug("Your filetype IS: ".$file->getMimeType());
// Check for SVG and sanitize it // Check for SVG and sanitize it
if ($file->getMimeType() === 'image/svg+xml') { if ($file->getMimeType() === 'image/svg+xml') {
\Log::debug('This is an SVG'); Log::debug('This is an SVG');
\Log::debug($file_name); Log::debug($file_name);
$sanitizer = new Sanitizer(); $sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath()); $dirtySVG = file_get_contents($file->getRealPath());
@ -57,13 +58,13 @@ class UploadFileRequest extends Request
try { try {
Storage::put($dirname.$file_name, $cleanSVG); Storage::put($dirname.$file_name, $cleanSVG);
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Upload no workie :( '); Log::debug('Upload no workie :( ');
\Log::debug($e); Log::debug($e);
} }
} else { } else {
$put_results = Storage::put($dirname.$file_name, file_get_contents($file)); $put_results = Storage::put($dirname.$file_name, file_get_contents($file));
\Log::debug("Here are the '$put_results' (should be 0 or 1 or true or false or something?)"); Log::debug("Here are the '$put_results' (should be 0 or 1 or true or false or something?)");
} }
return $file_name; return $file_name;
} }

View file

@ -6,6 +6,7 @@ use Illuminate\Http\UploadedFile;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
trait ConvertsBase64ToFiles trait ConvertsBase64ToFiles
{ {
@ -63,13 +64,13 @@ trait ConvertsBase64ToFiles
$uploadedFile = new UploadedFile($tempFilePath, $filename, null, null, true); $uploadedFile = new UploadedFile($tempFilePath, $filename, null, null, true);
\Log::debug("Trait: uploadedfile ". $tempFilePath); Log::debug("Trait: uploadedfile ". $tempFilePath);
$this->offsetUnset($key); $this->offsetUnset($key);
\Log::debug("Trait: encoded field \"$key\" removed" ); Log::debug("Trait: encoded field \"$key\" removed" );
//Inserting new file to $this-files does not work so have to deal this after //Inserting new file to $this-files does not work so have to deal this after
$this->offsetSet($key,$uploadedFile); $this->offsetSet($key,$uploadedFile);
\Log::debug("Trait: field \"$key\" inserted as UplodedFile" ); Log::debug("Trait: field \"$key\" inserted as UplodedFile" );
}, null, false); }, null, false);
}); });

View file

@ -3,6 +3,7 @@
namespace App\Http\Traits; namespace App\Http\Traits;
use App\Models\Asset; use App\Models\Asset;
use Illuminate\Support\Facades\Log;
trait MigratesLegacyAssetLocations trait MigratesLegacyAssetLocations
{ {
@ -17,17 +18,17 @@ trait MigratesLegacyAssetLocations
private function migrateLegacyLocations(Asset $asset): void private function migrateLegacyLocations(Asset $asset): void
{ {
if ($asset->rtd_location_id == '0') { if ($asset->rtd_location_id == '0') {
\Log::debug('Manually override the RTD location IDs'); Log::debug('Manually override the RTD location IDs');
\Log::debug('Original RTD Location ID: ' . $asset->rtd_location_id); Log::debug('Original RTD Location ID: ' . $asset->rtd_location_id);
$asset->rtd_location_id = ''; $asset->rtd_location_id = '';
\Log::debug('New RTD Location ID: ' . $asset->rtd_location_id); Log::debug('New RTD Location ID: ' . $asset->rtd_location_id);
} }
if ($asset->location_id == '0') { if ($asset->location_id == '0') {
\Log::debug('Manually override the location IDs'); Log::debug('Manually override the location IDs');
\Log::debug('Original Location ID: ' . $asset->location_id); Log::debug('Original Location ID: ' . $asset->location_id);
$asset->location_id = ''; $asset->location_id = '';
\Log::debug('New Location ID: ' . $asset->location_id); Log::debug('New Location ID: ' . $asset->location_id);
} }
} }
} }

View file

@ -15,6 +15,7 @@ use Illuminate\Database\Eloquent\Collection;
use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
class ActionlogsTransformer class ActionlogsTransformer
{ {
@ -87,17 +88,17 @@ class ActionlogsTransformer
if ($this->clean_field($fieldata->old!='')) { if ($this->clean_field($fieldata->old!='')) {
try { try {
$enc_old = \Crypt::decryptString($this->clean_field($fieldata->old)); $enc_old = Crypt::decryptString($this->clean_field($fieldata->old));
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Could not decrypt old field value - maybe the key changed?'); Log::debug('Could not decrypt old field value - maybe the key changed?');
} }
} }
if ($this->clean_field($fieldata->new!='')) { if ($this->clean_field($fieldata->new!='')) {
try { try {
$enc_new = \Crypt::decryptString($this->clean_field($fieldata->new)); $enc_new = Crypt::decryptString($this->clean_field($fieldata->new));
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug('Could not decrypt new field value - maybe the key changed?'); Log::debug('Could not decrypt new field value - maybe the key changed?');
} }
} }
@ -191,7 +192,7 @@ class ActionlogsTransformer
'action_date' => ($actionlog->action_date) ? Helper::getFormattedDateObject($actionlog->action_date, 'datetime'): Helper::getFormattedDateObject($actionlog->created_at, 'datetime'), 'action_date' => ($actionlog->action_date) ? Helper::getFormattedDateObject($actionlog->action_date, 'datetime'): Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
]; ];
// \Log::info("Clean Meta is: ".print_r($clean_meta,true)); // Log::info("Clean Meta is: ".print_r($clean_meta,true));
//dd($array); //dd($array);
return $array; return $array;

View file

@ -8,7 +8,7 @@ use App\Models\Setting;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Carbon\Carbon; use Carbon\Carbon;
use Auth; use Illuminate\Support\Facades\Auth;
class AssetsTransformer class AssetsTransformer
{ {

View file

@ -34,8 +34,8 @@ class AssetImporter extends ItemImporter
if ($customFieldValue) { if ($customFieldValue) {
if ($customField->field_encrypted == 1) { if ($customField->field_encrypted == 1) {
$this->item['custom_fields'][$customField->db_column_name()] = \Crypt::encrypt($customFieldValue); $this->item['custom_fields'][$customField->db_column_name()] = Crypt::encrypt($customFieldValue);
$this->log('Custom Field '.$customField->name.': '.\Crypt::encrypt($customFieldValue)); $this->log('Custom Field '.$customField->name.': '.Crypt::encrypt($customFieldValue));
} else { } else {
$this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue; $this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue;
$this->log('Custom Field '.$customField->name.': '.$customFieldValue); $this->log('Custom Field '.$customField->name.': '.$customFieldValue);

View file

@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use League\Csv\Reader; use League\Csv\Reader;
use Illuminate\Support\Facades\Log;
abstract class Importer abstract class Importer
{ {
@ -323,9 +324,9 @@ abstract class Importer
// If the full name and username is empty, bail out--we need this to extract first name (at the very least) // If the full name and username is empty, bail out--we need this to extract first name (at the very least)
if ((empty($user_array['username'])) && (empty($user_array['full_name'])) && (empty($user_array['first_name']))) { if ((empty($user_array['username'])) && (empty($user_array['full_name'])) && (empty($user_array['first_name']))) {
$this->log('Insufficient user data provided (Full name, first name or username is required) - skipping user creation.'); $this->log('Insufficient user data provided (Full name, first name or username is required) - skipping user creation.');
\Log::debug('User array: '); Log::debug('User array: ');
\Log::debug(print_r($user_array, true)); Log::debug(print_r($user_array, true));
\Log::debug(print_r($row, true)); Log::debug(print_r($row, true));
return false; return false;
} }
@ -373,7 +374,7 @@ abstract class Importer
$user->activated = 1; $user->activated = 1;
$user->password = $this->tempPassword; $user->password = $this->tempPassword;
\Log::debug('Creating a user with the following attributes: '.print_r($user_array, true)); Log::debug('Creating a user with the following attributes: '.print_r($user_array, true));
if ($user->save()) { if ($user->save()) {
$this->log('User '.$user_array['username'].' created'); $this->log('User '.$user_array['username'].' created');

View file

@ -3,6 +3,7 @@
namespace App\Importer; namespace App\Importer;
use App\Models\Location; use App\Models\Location;
use Illuminate\Support\Facades\Log;
/** /**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in * When we are importing users via an Asset/etc import, we use createOrFetchUser() in
@ -76,15 +77,15 @@ class LocationImporter extends ItemImporter
} }
} }
\Log::debug('Item array is: '); Log::debug('Item array is: ');
\Log::debug(print_r($this->item, true)); Log::debug(print_r($this->item, true));
if ($editingLocation) { if ($editingLocation) {
\Log::debug('Updating existing location'); Log::debug('Updating existing location');
$location->update($this->sanitizeItemForUpdating($location)); $location->update($this->sanitizeItemForUpdating($location));
} else { } else {
\Log::debug('Creating location'); Log::debug('Creating location');
$location->fill($this->sanitizeItemForStoring($location)); $location->fill($this->sanitizeItemForStoring($location));
} }
@ -93,7 +94,7 @@ class LocationImporter extends ItemImporter
return $location; return $location;
} else { } else {
\Log::debug($location->getErrors()); Log::debug($location->getErrors());
return $location->errors; return $location->errors;
} }

View file

@ -7,6 +7,7 @@ use App\Models\Department;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use App\Notifications\WelcomeNotification; use App\Notifications\WelcomeNotification;
use Illuminate\Support\Facades\Log;
/** /**
* This is ONLY used for the User Import. When we are importing users * This is ONLY used for the User Import. When we are importing users
@ -88,7 +89,7 @@ class UserImporter extends ItemImporter
if ($user) { if ($user) {
if (! $this->updating) { if (! $this->updating) {
\Log::debug('A matching User '.$this->item['name'].' already exists. '); Log::debug('A matching User '.$this->item['name'].' already exists. ');
return; return;
} }
$this->log('Updating User'); $this->log('Updating User');
@ -100,7 +101,7 @@ class UserImporter extends ItemImporter
->where('assigned_to', $user->id) ->where('assigned_to', $user->id)
->update(['location_id' => $user->location_id]); ->update(['location_id' => $user->location_id]);
// \Log::debug('UserImporter.php Updated User ' . print_r($user, true)); // Log::debug('UserImporter.php Updated User ' . print_r($user, true));
return; return;
} }

View file

@ -21,7 +21,7 @@ use App\Notifications\CheckoutLicenseSeatNotification;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Exception; use Exception;
use Log; use Illuminate\Support\Facades\Log;
class CheckoutableListener class CheckoutableListener
{ {
@ -80,7 +80,7 @@ class CheckoutableListener
*/ */
public function onCheckedIn($event) public function onCheckedIn($event)
{ {
\Log::debug('onCheckedIn in the Checkoutable listener fired'); Log::debug('onCheckedIn in the Checkoutable listener fired');
if ($this->shouldNotSendAnyNotifications($event->checkoutable)) { if ($this->shouldNotSendAnyNotifications($event->checkoutable)) {
return; return;
@ -199,7 +199,7 @@ class CheckoutableListener
break; break;
} }
\Log::debug('Notification class: '.$notificationClass); Log::debug('Notification class: '.$notificationClass);
return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedInBy, $event->note); return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedInBy, $event->note);
} }

View file

@ -3,8 +3,9 @@
namespace App\Listeners; namespace App\Listeners;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Auth\Events\Failed; use Illuminate\Auth\Events\Failed;
use Illuminate\Support\Facades\Log;
class LogFailedLogin class LogFailedLogin
{ {
@ -38,7 +39,7 @@ class LogFailedLogin
] ]
); );
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
} }

View file

@ -21,6 +21,7 @@ use App\Models\Actionlog;
use App\Models\User; use App\Models\User;
use App\Models\LicenseSeat; use App\Models\LicenseSeat;
use App\Events\UserMerged; use App\Events\UserMerged;
use Illuminate\Support\Facades\Log;
class LogListener class LogListener
{ {
@ -56,7 +57,7 @@ class LogListener
public function onCheckoutAccepted(CheckoutAccepted $event) public function onCheckoutAccepted(CheckoutAccepted $event)
{ {
\Log::debug('event passed to the onCheckoutAccepted listener:'); Log::debug('event passed to the onCheckoutAccepted listener:');
$logaction = new Actionlog(); $logaction = new Actionlog();
$logaction->item()->associate($event->acceptance->checkoutable); $logaction->item()->associate($event->acceptance->checkoutable);
$logaction->target()->associate($event->acceptance->assignedTo); $logaction->target()->associate($event->acceptance->assignedTo);
@ -102,7 +103,7 @@ class LogListener
]; ];
// Add a record to the users being merged FROM // Add a record to the users being merged FROM
\Log::debug('Users merged: '.$event->merged_from->id .' ('.$event->merged_from->username.') merged into '. $event->merged_to->id. ' ('.$event->merged_to->username.')'); Log::debug('Users merged: '.$event->merged_from->id .' ('.$event->merged_from->username.') merged into '. $event->merged_to->id. ' ('.$event->merged_to->username.')');
$logaction = new Actionlog(); $logaction = new Actionlog();
$logaction->item_id = $event->merged_from->id; $logaction->item_id = $event->merged_from->id;
$logaction->item_type = User::class; $logaction->item_type = User::class;

View file

@ -3,9 +3,9 @@
namespace App\Listeners; namespace App\Listeners;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Auth\Events\Login; use Illuminate\Auth\Events\Login;
use Illuminate\Support\Facades\Log;
class LogSuccessfulLogin class LogSuccessfulLogin
{ {
/** /**
@ -39,7 +39,7 @@ class LogSuccessfulLogin
] ]
); );
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::debug($e); Log::debug($e);
} }
} }
} }

View file

@ -11,9 +11,9 @@ use App\Models\Traits\Acceptable;
use App\Models\Traits\Searchable; use App\Models\Traits\Searchable;
use App\Presenters\Presentable; use App\Presenters\Presentable;
use AssetPresenter; use AssetPresenter;
use Auth; use Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;

View file

@ -4,12 +4,12 @@ namespace App\Models;
use App\Models\Traits\Searchable; use App\Models\Traits\Searchable;
use App\Presenters\Presentable; use App\Presenters\Presentable;
use Auth; use Illuminate\Support\Facades\Auth;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
use Illuminate\Support\Facades\Log;
/** /**
* Model for Companies. * Model for Companies.
* *
@ -152,13 +152,13 @@ final class Company extends SnipeModel
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\Log::warning($e); Log::warning($e);
} }
} }
if (Auth::user()) { if (Auth::user()) {
\Log::warning('Companyable is '.$companyable); Log::warning('Companyable is '.$companyable);
$current_user_company_id = Auth::user()->company_id; $current_user_company_id = Auth::user()->company_id;
$companyable_company_id = $companyable->company_id; $companyable_company_id = $companyable->company_id;
return $current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser(); return $current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser();
@ -309,7 +309,7 @@ final class Company extends SnipeModel
return $query; return $query;
} else { } else {
$f = function ($q) { $f = function ($q) {
\Log::debug('scopeCompanyablesDirectly firing '); Log::debug('scopeCompanyablesDirectly firing ');
static::scopeCompanyablesDirectly($q); static::scopeCompanyablesDirectly($q);
}; };

View file

@ -8,6 +8,7 @@ use Illuminate\Support\Facades\File;
use TCPDF; use TCPDF;
use TCPDF_STATIC; use TCPDF_STATIC;
use TypeError; use TypeError;
use Illuminate\Support\Facades\Log;
/** /**
* Model for Labels. * Model for Labels.
@ -374,7 +375,7 @@ abstract class Label
try { try {
$pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]); $pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
} catch (\Exception|TypeError $e) { } catch (\Exception|TypeError $e) {
\Log::debug('The 1D barcode ' . $value . ' is not compliant with the barcode type '. $type); Log::debug('The 1D barcode ' . $value . ' is not compliant with the barcode type '. $type);
} }
} }

View file

@ -7,7 +7,7 @@ use App\Models\User;
use Exception; use Exception;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Input; use Input;
use Log; use Illuminate\Support\Facades\Log;
/*********************************************** /***********************************************
* TODOS: * TODOS:
@ -117,10 +117,10 @@ class Ldap extends Model
$filter = Setting::getSettings()->ldap_filter; //FIXME - this *does* respect the ldap filter, but I believe that AdLdap2 did *not*. $filter = Setting::getSettings()->ldap_filter; //FIXME - this *does* respect the ldap filter, but I believe that AdLdap2 did *not*.
$filterQuery = "({$filter}({$filterQuery}))"; $filterQuery = "({$filter}({$filterQuery}))";
\Log::debug('Filter query: '.$filterQuery); Log::debug('Filter query: '.$filterQuery);
if (! $ldapbind = @ldap_bind($connection, $userDn, $password)) { if (! $ldapbind = @ldap_bind($connection, $userDn, $password)) {
\Log::debug("Status of binding user: $userDn to directory: (directly!) ".($ldapbind ? "success" : "FAILURE")); Log::debug("Status of binding user: $userDn to directory: (directly!) ".($ldapbind ? "success" : "FAILURE"));
if (! $ldapbind = self::bindAdminToLdap($connection)) { if (! $ldapbind = self::bindAdminToLdap($connection)) {
/* /*
* TODO PLEASE: * TODO PLEASE:
@ -135,7 +135,7 @@ class Ldap extends Model
* Let's definitely fix this at the next refactor!!!! * Let's definitely fix this at the next refactor!!!!
* *
*/ */
\Log::debug("Status of binding Admin user: $userDn to directory instead: ".($ldapbind ? "success" : "FAILURE")); Log::debug("Status of binding Admin user: $userDn to directory instead: ".($ldapbind ? "success" : "FAILURE"));
return false; return false;
} }
} }
@ -172,7 +172,7 @@ class Ldap extends Model
if ( $ldap_username ) { if ( $ldap_username ) {
// Lets return some nicer messages for users who donked their app key, and disable LDAP // Lets return some nicer messages for users who donked their app key, and disable LDAP
try { try {
$ldap_pass = \Crypt::decrypt(Setting::getSettings()->ldap_pword); $ldap_pass = Crypt::decrypt(Setting::getSettings()->ldap_pword);
} catch (Exception $e) { } catch (Exception $e) {
throw new Exception('Your app key has changed! Could not decrypt LDAP password using your current app key, so LDAP authentication has been disabled. Login with a local account, update the LDAP password and re-enable it in Admin > Settings.'); throw new Exception('Your app key has changed! Could not decrypt LDAP password using your current app key, so LDAP authentication has been disabled. Login with a local account, update the LDAP password and re-enable it in Admin > Settings.');
} }
@ -265,7 +265,7 @@ class Ldap extends Model
if ($user->save()) { if ($user->save()) {
return $user; return $user;
} else { } else {
\Log::debug('Could not create user.'.$user->getErrors()); Log::debug('Could not create user.'.$user->getErrors());
throw new Exception('Could not create user: '.$user->getErrors()); throw new Exception('Could not create user: '.$user->getErrors());
} }
} }
@ -318,7 +318,7 @@ class Ldap extends Model
$ldap_controls = [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => false, 'value' => ['size'=> $count == -1||$count>$page_size ? $page_size : $count, 'cookie' => $cookie]]]; $ldap_controls = [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => false, 'value' => ['size'=> $count == -1||$count>$page_size ? $page_size : $count, 'cookie' => $cookie]]];
//} //}
$search_results = ldap_search($ldapconn, $base_dn, $filter, [], 0, /* $page_size */ -1, -1, LDAP_DEREF_NEVER, $ldap_controls); // TODO - I hate the @, and I hate that we get a full page even if we ask for 10 records. Can we use an ldap_control? $search_results = ldap_search($ldapconn, $base_dn, $filter, [], 0, /* $page_size */ -1, -1, LDAP_DEREF_NEVER, $ldap_controls); // TODO - I hate the @, and I hate that we get a full page even if we ask for 10 records. Can we use an ldap_control?
\Log::debug("LDAP search executed successfully."); Log::debug("LDAP search executed successfully.");
if (! $search_results) { if (! $search_results) {
return redirect()->route('users.index')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn)); // TODO this is never called in any routed context - only from the Artisan command. So this redirect will never work. return redirect()->route('users.index')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn)); // TODO this is never called in any routed context - only from the Artisan command. So this redirect will never work.
} }
@ -332,9 +332,9 @@ class Ldap extends Model
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) { if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
// You need to pass the cookie from the last call to the next one // You need to pass the cookie from the last call to the next one
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']; $cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
\Log::debug("okay, at least one more page to go!!!"); Log::debug("okay, at least one more page to go!!!");
} else { } else {
\Log::debug("okay, we're out of pages - no cookie (or empty cookie) was passed"); Log::debug("okay, we're out of pages - no cookie (or empty cookie) was passed");
$cookie = ''; $cookie = '';
} }
// Empty cookie means last page // Empty cookie means last page
@ -348,7 +348,7 @@ class Ldap extends Model
// Add results to result set // Add results to result set
$global_count += $results['count']; $global_count += $results['count'];
$result_set = array_merge($result_set, $results); $result_set = array_merge($result_set, $results);
\Log::debug("Total count is: $global_count"); Log::debug("Total count is: $global_count");
} while ($cookie !== null && $cookie != '' && ($count == -1 || $global_count < $count)); // some servers don't even have pagination, and some will give you more results than you asked for, so just see if you have enough. } while ($cookie !== null && $cookie != '' && ($count == -1 || $global_count < $count)); // some servers don't even have pagination, and some will give you more results than you asked for, so just see if you have enough.

View file

@ -6,7 +6,7 @@ use App\Helpers\Helper;
use App\Models\Traits\Searchable; use App\Models\Traits\Searchable;
use App\Presenters\Presentable; use App\Presenters\Presentable;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;

View file

@ -8,7 +8,7 @@ use App\Models\SnipeModel;
use App\Models\Traits\Searchable; use App\Models\Traits\Searchable;
use App\Models\User; use App\Models\User;
use App\Presenters\Presentable; use App\Presenters\Presentable;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;

View file

@ -5,6 +5,7 @@ namespace App\Models;
use App\Models\Setting; use App\Models\Setting;
use App\Notifications\AuditNotification; use App\Notifications\AuditNotification;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
trait Loggable trait Loggable
{ {
@ -186,7 +187,7 @@ trait Loggable
// try { // try {
// $target->notify(new static::$checkinClass($params)); // $target->notify(new static::$checkinClass($params));
// } catch (\Exception $e) { // } catch (\Exception $e) {
// \Log::debug($e); // Log::debug($e);
// } // }
// //
// } // }
@ -198,7 +199,7 @@ trait Loggable
// try { // try {
// $recipient->notify(new static::$checkinClass($params)); // $recipient->notify(new static::$checkinClass($params));
// } catch (\Exception $e) { // } catch (\Exception $e) {
// \Log::debug($e); // Log::debug($e);
// } // }
// //
// } // }

View file

@ -10,6 +10,7 @@ use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use App\Helpers\Helper; use App\Helpers\Helper;
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
use Illuminate\Support\Facades\Log;
/** /**
@ -133,7 +134,7 @@ class Setting extends Model
return $usercount > 0 && $settingsCount > 0; return $usercount > 0 && $settingsCount > 0;
} catch (\Throwable $th) { } catch (\Throwable $th) {
\Log::debug('User table and settings table DO NOT exist or DO NOT have records'); Log::debug('User table and settings table DO NOT exist or DO NOT have records');
// Catch the error if the tables dont exit // Catch the error if the tables dont exit
return false; return false;
} }

View file

@ -3,7 +3,7 @@
namespace App\Models\Traits; namespace App\Models\Traits;
use App\Models\User; use App\Models\User;
use Illuminate\Support\Facades\Log;
/** /**
* This trait allows models to have a callback after their checkout gets accepted or declined. * This trait allows models to have a callback after their checkout gets accepted or declined.
* *
@ -19,7 +19,7 @@ trait Acceptable
*/ */
public function acceptedCheckout(User $acceptedBy, $signature, $filename = null) public function acceptedCheckout(User $acceptedBy, $signature, $filename = null)
{ {
\Log::debug('acceptedCheckout in Acceptable trait fired, tho it doesn\'t do anything?'); Log::debug('acceptedCheckout in Acceptable trait fired, tho it doesn\'t do anything?');
} }
/** /**

View file

@ -5,7 +5,7 @@ namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait; use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\Searchable; use App\Models\Traits\Searchable;
use App\Presenters\Presentable; use App\Presenters\Presentable;
use DB; use Illuminate\Support\Facades\DB;
use Illuminate\Auth\Authenticatable; use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;

View file

@ -16,6 +16,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
class CheckinAccessoryNotification extends Notification class CheckinAccessoryNotification extends Notification
{ {
@ -61,14 +62,14 @@ class CheckinAccessoryNotification extends Notification
* Only send notifications to users that have email addresses * Only send notifications to users that have email addresses
*/ */
if ($this->target instanceof User && $this->target->email != '') { if ($this->target instanceof User && $this->target->email != '') {
\Log::debug('The target is a user'); Log::debug('The target is a user');
if ($this->item->checkin_email()) { if ($this->item->checkin_email()) {
$notifyBy[] = 'mail'; $notifyBy[] = 'mail';
} }
} }
\Log::debug('checkin_email on this category is '.$this->item->checkin_email()); Log::debug('checkin_email on this category is '.$this->item->checkin_email());
return $notifyBy; return $notifyBy;
} }
@ -150,7 +151,7 @@ class CheckinAccessoryNotification extends Notification
*/ */
public function toMail() public function toMail()
{ {
\Log::debug('to email called'); Log::debug('to email called');
return (new MailMessage)->markdown('notifications.markdown.checkin-accessory', return (new MailMessage)->markdown('notifications.markdown.checkin-accessory',
[ [

View file

@ -17,7 +17,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
class CheckinAssetNotification extends Notification class CheckinAssetNotification extends Notification
{ {
use Queueable; use Queueable;
@ -61,7 +61,7 @@ class CheckinAssetNotification extends Notification
$notifyBy[] = MicrosoftTeamsChannel::class; $notifyBy[] = MicrosoftTeamsChannel::class;
} }
if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
\Log::debug('use webhook'); Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }

View file

@ -16,6 +16,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
class CheckoutAccessoryNotification extends Notification class CheckoutAccessoryNotification extends Notification
{ {
@ -168,7 +169,7 @@ class CheckoutAccessoryNotification extends Notification
*/ */
public function toMail() public function toMail()
{ {
\Log::debug($this->item->getImageUrl()); Log::debug($this->item->getImageUrl());
$eula = $this->item->getEula(); $eula = $this->item->getEula();
$req_accept = $this->item->requireAcceptance(); $req_accept = $this->item->requireAcceptance();

View file

@ -20,7 +20,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
class CheckoutAssetNotification extends Notification class CheckoutAssetNotification extends Notification
{ {
use Queueable; use Queueable;
@ -75,7 +75,7 @@ class CheckoutAssetNotification extends Notification
if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
\Log::debug('use webhook'); Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }

View file

@ -16,6 +16,7 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
class CheckoutConsumableNotification extends Notification class CheckoutConsumableNotification extends Notification
{ {
@ -172,7 +173,7 @@ class CheckoutConsumableNotification extends Notification
*/ */
public function toMail() public function toMail()
{ {
\Log::debug($this->item->getImageUrl()); Log::debug($this->item->getImageUrl());
$eula = $this->item->getEula(); $eula = $this->item->getEula();
$req_accept = $this->item->requireAcceptance(); $req_accept = $this->item->requireAcceptance();

View file

@ -7,6 +7,7 @@ use App\Models\Setting;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification; use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
class RequestAssetCancelation extends Notification class RequestAssetCancelation extends Notification
{ {
@ -58,7 +59,7 @@ class RequestAssetCancelation extends Notification
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->webhook_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
\Log::debug('use webhook'); Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }

View file

@ -4,7 +4,7 @@ namespace App\Observers;
use App\Models\Accessory; use App\Models\Accessory;
use App\Models\Actionlog; use App\Models\Actionlog;
use Auth; use Illuminate\Support\Facades\Auth;
class AccessoryObserver class AccessoryObserver
{ {

View file

@ -5,7 +5,7 @@ namespace App\Observers;
use App\Models\Actionlog; use App\Models\Actionlog;
use App\Models\Asset; use App\Models\Asset;
use App\Models\Setting; use App\Models\Setting;
use Auth; use Illuminate\Support\Facades\Auth;
use Carbon\Carbon; use Carbon\Carbon;
class AssetObserver class AssetObserver

View file

@ -4,7 +4,7 @@ namespace App\Observers;
use App\Models\Actionlog; use App\Models\Actionlog;
use App\Models\Component; use App\Models\Component;
use Auth; use Illuminate\Support\Facades\Auth;
class ComponentObserver class ComponentObserver
{ {

View file

@ -4,7 +4,7 @@ namespace App\Observers;
use App\Models\Actionlog; use App\Models\Actionlog;
use App\Models\Consumable; use App\Models\Consumable;
use Auth; use Illuminate\Support\Facades\Auth;
class ConsumableObserver class ConsumableObserver
{ {

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