Merge branch 'logging' into 'main'
Logging See merge request ase22ws/abschlussprojekt-device-manager-timon-lorenz!6
This commit is contained in:
commit
d24d167436
@ -7,6 +7,7 @@
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeviceController extends Controller
|
||||
{
|
||||
@ -39,6 +40,8 @@ public function store(Request $request)
|
||||
|
||||
Device::create($formFields);
|
||||
|
||||
Log::info('Device saved successfully');
|
||||
|
||||
return redirect('/devices');
|
||||
}
|
||||
|
||||
@ -63,6 +66,8 @@ public function update(Device $device, Request $request)
|
||||
|
||||
$device->update($formFields);
|
||||
|
||||
Log::info('Device updated successfully');
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
@ -70,6 +75,7 @@ public function destroy(Device $device): RedirectResponse
|
||||
{
|
||||
$this->authorize('admin-only');
|
||||
$device->delete();
|
||||
Log::info('Device deleted successfully');
|
||||
return redirect('devices');
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
use App\Models\Device;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\LocationTransaction;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LocationTransactionController extends Controller
|
||||
{
|
||||
@ -23,6 +24,8 @@ public function store(Device $device, Request $request)
|
||||
$formFields['device_id'] = $device->device_id;
|
||||
LocationTransaction::create($formFields);
|
||||
|
||||
Log::info('Location saved successfully');
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
@ -42,6 +45,8 @@ public function update(LocationTransaction $location, Request $request)
|
||||
|
||||
$location->update($formFields);
|
||||
|
||||
Log::info('Location updated successfully');
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
@ -49,6 +54,9 @@ public function destroy(LocationTransaction $location)
|
||||
{
|
||||
$this->authorize('admin-only');
|
||||
$location->delete();
|
||||
|
||||
Log::info('Location deleted successfully');
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
use App\Models\Device;
|
||||
use App\Models\OwnerTransaction;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class OwnerTransactionController extends Controller
|
||||
{
|
||||
@ -23,6 +24,8 @@ public function store(Device $device, Request $request)
|
||||
$formFields['device_id'] = $device->device_id;
|
||||
OwnerTransaction::create($formFields);
|
||||
|
||||
Log::info('Owner saved successfully');
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
@ -42,6 +45,8 @@ public function update(OwnerTransaction $owner, Request $request)
|
||||
|
||||
$owner->update($formFields);
|
||||
|
||||
Log::info('Owner updated successfully');
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
@ -49,6 +54,9 @@ public function destroy(OwnerTransaction $owner)
|
||||
{
|
||||
$this->authorize('admin-only');
|
||||
$owner->delete();
|
||||
|
||||
Log::info('Owner deleted successfully');
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\PurchasingInformation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PurchasingInformationController extends Controller
|
||||
{
|
||||
@ -27,6 +27,8 @@ public function update(Device $device, Request $request)
|
||||
|
||||
$device->purchasing->update($formFields);
|
||||
|
||||
Log::info('Purchasing Information updated successfully');
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,9 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
@ -29,6 +30,8 @@ public function store(Request $request)
|
||||
$user = User::create($formFields);
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
Log::info('User successfully created');
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
@ -47,6 +50,8 @@ public function authenticate(Request $request)
|
||||
if (auth()->attempt($formFields)) {
|
||||
$request->session()->regenerate();
|
||||
|
||||
Log::info('User authenticated successfully');
|
||||
|
||||
return redirect('/home');
|
||||
}
|
||||
}
|
||||
@ -58,6 +63,8 @@ public function logout(Request $request)
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
Log::info('User successfully logged out');
|
||||
|
||||
return redirect('/home');
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Opcodes\LogViewer\Facades\LogViewer;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@ -19,6 +20,8 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
LogViewer::auth(function ($request) {
|
||||
return $request->user()->has_admin_privileges ?? false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.8"
|
||||
"laravel/tinker": "^2.8",
|
||||
"opcodesio/log-viewer": "^2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
|
80
device-app/composer.lock
generated
80
device-app/composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "121ea3a2fffe49b3ef9aa4d064b28c19",
|
||||
"content-hash": "c44663c5494a74be165db681dcf19ddb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -2203,6 +2203,84 @@
|
||||
],
|
||||
"time": "2023-02-08T01:06:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "opcodesio/log-viewer",
|
||||
"version": "v2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opcodesio/log-viewer.git",
|
||||
"reference": "eed37452d580e8929045e34dc7016420d9bd9bcd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/opcodesio/log-viewer/zipball/eed37452d580e8929045e34dc7016420d9bd9bcd",
|
||||
"reference": "eed37452d580e8929045e34dc7016420d9bd9bcd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^8.0|^9.0|^10.0",
|
||||
"php": "^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"arcanedev/log-viewer": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"itsgoingd/clockwork": "^5.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"nunomaduro/collision": "^6.0",
|
||||
"orchestra/testbench": "^7.6|^8.0",
|
||||
"pestphp/pest": "^1.21",
|
||||
"pestphp/pest-plugin-laravel": "^1.1",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"spatie/test-time": "^1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"guzzlehttp/guzzle": "Required for multi-host support. ^7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Opcodes\\LogViewer\\LogViewerServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"LogViewer": "Opcodes\\LogViewer\\Facades\\LogViewer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Opcodes\\LogViewer\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arunas Skirius",
|
||||
"email": "arukomp@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Fast and easy-to-use log viewer for your Laravel application",
|
||||
"homepage": "https://github.com/opcodesio/log-viewer",
|
||||
"keywords": [
|
||||
"arukompas",
|
||||
"better-log-viewer",
|
||||
"laravel",
|
||||
"log viewer",
|
||||
"logs",
|
||||
"opcodesio"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/opcodesio/log-viewer/issues",
|
||||
"source": "https://github.com/opcodesio/log-viewer/tree/v2.4.0"
|
||||
},
|
||||
"time": "2023-03-31T07:50:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
"version": "1.9.1",
|
||||
|
1
device-app/public/vendor/log-viewer/app.css
vendored
Normal file
1
device-app/public/vendor/log-viewer/app.css
vendored
Normal file
File diff suppressed because one or more lines are too long
2
device-app/public/vendor/log-viewer/app.js
vendored
Normal file
2
device-app/public/vendor/log-viewer/app.js
vendored
Normal file
File diff suppressed because one or more lines are too long
19
device-app/public/vendor/log-viewer/app.js.LICENSE.txt
vendored
Normal file
19
device-app/public/vendor/log-viewer/app.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <http://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
BIN
device-app/public/vendor/log-viewer/img/log-viewer-128.png
vendored
Normal file
BIN
device-app/public/vendor/log-viewer/img/log-viewer-128.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
device-app/public/vendor/log-viewer/img/log-viewer-32.png
vendored
Normal file
BIN
device-app/public/vendor/log-viewer/img/log-viewer-32.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 526 B |
BIN
device-app/public/vendor/log-viewer/img/log-viewer-64.png
vendored
Normal file
BIN
device-app/public/vendor/log-viewer/img/log-viewer-64.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 970 B |
7
device-app/public/vendor/log-viewer/mix-manifest.json
vendored
Normal file
7
device-app/public/vendor/log-viewer/mix-manifest.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"/app.js": "/app.js?id=2a99c3e02b0ac95a07b0b1ee6c098c2a",
|
||||
"/app.css": "/app.css?id=2d577fa607de6eeef7cfb84d3b72b864",
|
||||
"/img/log-viewer-128.png": "/img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166",
|
||||
"/img/log-viewer-32.png": "/img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d",
|
||||
"/img/log-viewer-64.png": "/img/log-viewer-64.png?id=8902d596fc883ca9eb8105bb683568c6"
|
||||
}
|
@ -3,4 +3,8 @@
|
||||
@section('content')
|
||||
<h1>Welcome</h1>
|
||||
<a href="/devices">To List</a>
|
||||
<br/>
|
||||
@can('admin-only')
|
||||
<a href="/log-viewer">To Log Viewer</a>
|
||||
@endcan
|
||||
@endsection
|
Loading…
Reference in New Issue
Block a user