Skip to content

Commit 4b57b65

Browse files
committed
log module update
1 parent 3eb4f28 commit 4b57b65

25 files changed

+996
-14
lines changed

app/Http/Controllers/Backend/BackupController.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function index()
2121
Gate::authorize('backup-index');
2222
$disk = Storage::disk(config('backup.backup.destination.disks')[0]);
2323
$files = $disk->files(config('backup.backup.name'));
24-
return $files;
2524

2625
$backups = [];
2726

@@ -75,8 +74,8 @@ public function store(Request $request)
7574
{
7675
Gate::authorize('backup-create');
7776
Artisan::call('backup:run');
78-
79-
notify()->success("Backup Created", "Success");
77+
\LogActivity::addToLog('Backup created!.');
78+
toast('Backup Created!', 'success');
8079
return back();
8180
}
8281
public function download($file_name)
@@ -145,16 +144,17 @@ public function destroy($file_name)
145144
if ($disk->exists(config('backup.backup.name') . '/' . $file_name)) {
146145
$disk->delete(config('backup.backup.name') . '/' . $file_name);
147146
}
148-
notify()->success("Backup Deleted", "Success");
147+
\LogActivity::addToLog('Backup deleted!.');
148+
toast('Backup Deleted!', 'success');
149149
return back();
150150
}
151151
public function clean()
152152
{
153153
Gate::authorize('backup-delete');
154154

155155
Artisan::call('backup:clean');
156-
157-
notify()->success("All Old Backup has been deleted", "Success");
156+
\LogActivity::addToLog('Old Backup has been deleted!.');
157+
toast('All Old Backup has been deleted!', 'success');
158158
return back();
159159
}
160160
}

app/Http/Controllers/Backend/LogActivityController.php

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Models\LogActivity;
77
use Illuminate\Http\Request;
88
use Auth;
9+
use Illuminate\Support\Facades\Gate;
910

1011
class LogActivityController extends Controller
1112
{
@@ -15,6 +16,7 @@ public function __construct()
1516

1617
public function index()
1718
{
19+
Gate::authorize('log-index');
1820
$logs = \LogActivity::logActivityLists();
1921
return view('backend.logs.index', compact('logs'));
2022
}
@@ -25,6 +27,7 @@ public function store()
2527
dd('log insert successfully.');
2628
}
2729
public function delete($id){
30+
Gate::authorize('log-delete');
2831
try {
2932
$log = LogActivity::findOrFail($id);
3033
$log->delete($log);

app/Http/Controllers/Backend/ModuleController.php

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Repository\ModuleRepositoryInterface;
99
use App\Repository\Permission\PermissionRepositoryInterface;
1010
use Illuminate\Support\Facades\DB;
11+
use Illuminate\Support\Facades\Gate;
1112

1213
class ModuleController extends Controller
1314
{
@@ -28,6 +29,7 @@ public function __construct(ModuleRepositoryInterface $moduleRepository, Permiss
2829

2930
public function index()
3031
{
32+
Gate::authorize('module-index');
3133
$modules = $this->moduleRepository->index();
3234
return view('backend.modules.index', compact('modules'));
3335
}
@@ -39,6 +41,7 @@ public function index()
3941
*/
4042
public function create()
4143
{
44+
Gate::authorize('module-create');
4245
return view('backend.modules.form');
4346
}
4447

@@ -50,6 +53,7 @@ public function create()
5053
*/
5154
public function store(ModuleRequest $request)
5255
{
56+
Gate::authorize('module-create');
5357
DB::beginTransaction();
5458
try {
5559
$module = [
@@ -79,6 +83,7 @@ public function store(ModuleRequest $request)
7983
*/
8084
public function show(Module $module)
8185
{
86+
Gate::authorize('module-index');
8287
return $this->moduleRepository->show($module);
8388
}
8489

@@ -90,6 +95,7 @@ public function show(Module $module)
9095
*/
9196
public function edit(Module $module)
9297
{
98+
Gate::authorize('module-update');
9399
return view('backend.modules.form', compact('module'));
94100
}
95101

@@ -102,6 +108,7 @@ public function edit(Module $module)
102108
*/
103109
public function update(ModuleRequest $request, Module $module)
104110
{
111+
Gate::authorize('module-update');
105112
DB::beginTransaction();
106113
try {
107114
$data = [
@@ -130,6 +137,7 @@ public function update(ModuleRequest $request, Module $module)
130137
*/
131138
public function destroy(Module $module)
132139
{
140+
Gate::authorize('module-delete');
133141
try {
134142
if($module->permissions()->count()){
135143
toast( "Can't delete, Module has permission record.", 'success');

app/Http/Controllers/Backend/PermissionController.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function store(PermissionRequest $request)
6262
];
6363

6464
$permission = $this->permissionRepository->create($data);
65-
65+
\LogActivity::addToLog('Permission Added!.');
6666
toast('Permission Added', 'success');
6767

6868
return redirect()->route('app.permissions.index');
@@ -110,7 +110,7 @@ public function update(PermissionRequest $request, Permission $permission)
110110
];
111111

112112
$permission = $this->permissionRepository->update($permission, $data);
113-
113+
\LogActivity::addToLog('Permission Updated!.');
114114
toast('Permission Updated', 'success');
115115
return redirect()->route('app.permissions.index');
116116
}
@@ -125,6 +125,7 @@ public function destroy(Permission $permission)
125125
{
126126
Gate::authorize('permission-delete');
127127
$this->permissionRepository->delete($permission);
128+
\LogActivity::addToLog('Permission Deleted!.');
128129
toast('Permission Deleted', 'success');
129130
return back();
130131
}

app/Http/Controllers/Backend/RoleController.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public function store(RoleRequest $request)
7171
];
7272

7373
$role = $this->roleRepository->create($data)->permissions()->sync($request->input('permissions'), []);
74-
toast('Role Added', 'success');
74+
\LogActivity::addToLog('Role Added!.');
75+
toast('Role Added.', 'success');
7576
return redirect()->route('app.roles.index');
7677
}
7778

@@ -133,7 +134,8 @@ public function update(RoleRequest $request, Role $role)
133134
// $role->permissions()->sync($request->input('permissions'));
134135
// }
135136
$role->permissions()->sync($request->input('permissions'));
136-
toast('Role Updated', 'success');
137+
\LogActivity::addToLog('Role Updated!.');
138+
toast('Role Updated.', 'success');
137139
return redirect()->route('app.roles.index');
138140
}
139141

@@ -148,7 +150,8 @@ public function destroy(Role $role)
148150
Gate::authorize('role-delete');
149151
if ($role->deletable) {
150152
$this->roleRepository->delete($role);
151-
toast('Role Deleted', 'success');
153+
\LogActivity::addToLog('Role Deleted!.');
154+
toast('Role Deleted.', 'success');
152155
} else {
153156
toast('You can\'t delete system role', 'error');
154157
}

app/Http/Controllers/Backend/UserController.php

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function store(UserRequest $request)
7474
];
7575

7676
$user = $this->userRepository->create($data);
77+
\LogActivity::addToLog('User Added!.');
7778
toast('User Added successfully!', 'success');
7879

7980
return redirect()->route('app.users.index');
@@ -140,6 +141,7 @@ public function update(UserRequest $request, User $user)
140141
];
141142
$user = $this->userRepository->update($user, $data);
142143

144+
\LogActivity::addToLog('User Updated!.');
143145
toast('User Updated successfully!', 'success');
144146
return redirect()->route('app.users.index');
145147
}
@@ -161,6 +163,7 @@ public function destroy(User $user)
161163
}
162164
}
163165

166+
\LogActivity::addToLog('User Deleted!.');
164167
toast('User Deleted successfully!', 'success');
165168
return redirect()->route('app.users.index');
166169
}

resources/views/backend/logs/index.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<td class="text-center">{{ $item->agent }}</td>
5656

5757
<td class="text-center">
58-
@permission('role-delete')
58+
@permission('log-delete')
5959
<button onclick="deleteData({{$item->id}})" type="button" class="btn btn-danger"><i
6060
class="fas fa-trash"></i></button>
6161
<form id="delete-{{$item->id}}" method="POST"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a:4:{s:6:"_token";s:40:"wE4pCGBNdi0P7eKrxYRCaUBZxr3Bq8ZcPZrqBDyh";s:9:"_previous";a:1:{s:3:"url";s:27:"http://127.0.0.1:8000/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:50:"login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d";i:1;}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a:6:{s:6:"_token";s:40:"zh6AG5LawsRWt3dVlopsyOt6ixMoU1PNyLTMOYCG";s:3:"url";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:34:"http://quickadmin.test:81/app/logs";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:50:"login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d";i:1;s:5:"alert";a:0:{}}
1+
a:6:{s:6:"_token";s:40:"d0Zx4JLZLUBAGSGClaesVFKjbLGzwfeJRSV2bCMK";s:3:"url";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:34:"http://quickadmin.test:81/app/logs";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:50:"login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d";i:1;s:5:"alert";a:0:{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
<meta name="color-scheme" content="light">
7+
<meta name="supported-color-schemes" content="light">
8+
<style>
9+
@media only screen and (max-width: 600px) {
10+
.inner-body {
11+
width: 100% !important;
12+
}
13+
14+
.footer {
15+
width: 100% !important;
16+
}
17+
}
18+
19+
@media only screen and (max-width: 500px) {
20+
.button {
21+
width: 100% !important;
22+
}
23+
}
24+
</style>
25+
</head>
26+
<body>
27+
28+
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
29+
<tr>
30+
<td align="center">
31+
<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
32+
<?php echo e($header ?? ''); ?>
33+
34+
35+
<!-- Email Body -->
36+
<tr>
37+
<td class="body" width="100%" cellpadding="0" cellspacing="0">
38+
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
39+
<!-- Body content -->
40+
<tr>
41+
<td class="content-cell">
42+
<?php echo e(Illuminate\Mail\Markdown::parse($slot)); ?>
43+
44+
45+
<?php echo e($subcopy ?? ''); ?>
46+
47+
</td>
48+
</tr>
49+
</table>
50+
</td>
51+
</tr>
52+
53+
<?php echo e($footer ?? ''); ?>
54+
55+
</table>
56+
</td>
57+
</tr>
58+
</table>
59+
</body>
60+
</html>
61+
<?php /**PATH D:\laragon\www\QuickAdmin\vendor\laravel\framework\src\Illuminate\Mail/resources/views/html/layout.blade.php ENDPATH**/ ?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php $__env->startComponent('mail::layout'); ?>
2+
3+
<?php $__env->slot('header'); ?>
4+
<?php $__env->startComponent('mail::header', ['url' => config('app.url')]); ?>
5+
<?php echo e(config('app.name')); ?>
6+
7+
<?php echo $__env->renderComponent(); ?>
8+
<?php $__env->endSlot(); ?>
9+
10+
11+
<?php echo e($slot); ?>
12+
13+
14+
15+
<?php if(isset($subcopy)): ?>
16+
<?php $__env->slot('subcopy'); ?>
17+
<?php $__env->startComponent('mail::subcopy'); ?>
18+
<?php echo e($subcopy); ?>
19+
20+
<?php echo $__env->renderComponent(); ?>
21+
<?php $__env->endSlot(); ?>
22+
<?php endif; ?>
23+
24+
25+
<?php $__env->slot('footer'); ?>
26+
<?php $__env->startComponent('mail::footer'); ?>
27+
© <?php echo e(date('Y')); ?> <?php echo e(config('app.name')); ?>. <?php echo app('translator')->get('All rights reserved.'); ?>
28+
<?php echo $__env->renderComponent(); ?>
29+
<?php $__env->endSlot(); ?>
30+
<?php echo $__env->renderComponent(); ?>
31+
<?php /**PATH D:\laragon\www\QuickAdmin\vendor\laravel\framework\src\Illuminate\Mail/resources/views/text/message.blade.php ENDPATH**/ ?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<tr>
2+
<td>
3+
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
4+
<tr>
5+
<td class="content-cell" align="center">
6+
<?php echo e(Illuminate\Mail\Markdown::parse($slot)); ?>
7+
8+
</td>
9+
</tr>
10+
</table>
11+
</td>
12+
</tr>
13+
<?php /**PATH D:\laragon\www\QuickAdmin\vendor\laravel\framework\src\Illuminate\Mail/resources/views/html/footer.blade.php ENDPATH**/ ?>

0 commit comments

Comments
 (0)