Add MogLog System

This commit is contained in:
2026-05-06 21:08:51 +02:00
parent fdf26604f3
commit 75f631c3e6
3 changed files with 54 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Livewire;
use App\Enums\UserRole;
use App\Models\Episode;
use App\Models\ModLog;
use App\Models\User;
use App\Notifications\CommentNotification;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
@@ -71,6 +72,12 @@ class Comment extends Component
$user = Auth::user();
if ($user->hasRole(UserRole::ADMINISTRATOR) || $user->hasRole(UserRole::MODERATOR)) {
// Log to ModLog
ModLog::create([
'moderator' => $user->name,
'data' => "Deleted comment {$this->comment->id} written by {$this->comment->user->id} with contents: {$this->comment->body}",
]);
$this->comment->deleted_by_moderator_id = $user->id;
$this->comment->save();
$this->dispatch('refresh');