Show related log entries on admin pages.
This commit is contained in:
parent
0307fbc595
commit
1af9715682
|
|
@ -7,6 +7,7 @@ use App\Actions\Entries\UpdateEntry;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\EntryStoreRequest;
|
use App\Http\Requests\EntryStoreRequest;
|
||||||
use App\Models\Audition;
|
use App\Models\Audition;
|
||||||
|
use App\Models\AuditLogEntry;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use App\Models\School;
|
use App\Models\School;
|
||||||
use App\Models\Seat;
|
use App\Models\Seat;
|
||||||
|
|
@ -139,7 +140,9 @@ class EntryController extends Controller
|
||||||
// TODO: When updating Laravel, can we use the chaperone method I heard about ot load the entry back into the score
|
// TODO: When updating Laravel, can we use the chaperone method I heard about ot load the entry back into the score
|
||||||
$scores = $entry->scoreSheets()->with('audition', 'judge', 'entry')->get();
|
$scores = $entry->scoreSheets()->with('audition', 'judge', 'entry')->get();
|
||||||
|
|
||||||
return view('admin.entries.edit', compact('entry', 'students', 'auditions', 'scores'));
|
$logEntries = AuditLogEntry::whereJsonContains('affected->entries', $entry->id)->orderBy('created_at', 'desc')->get();
|
||||||
|
|
||||||
|
return view('admin.entries.edit', compact('entry', 'students', 'auditions', 'scores', 'logEntries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, Entry $entry, UpdateEntry $updater)
|
public function update(Request $request, Entry $entry, UpdateEntry $updater)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use App\Actions\Schools\CreateSchool;
|
||||||
use App\Actions\Schools\SetHeadDirector;
|
use App\Actions\Schools\SetHeadDirector;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\SchoolStoreRequest;
|
use App\Http\Requests\SchoolStoreRequest;
|
||||||
|
use App\Models\AuditLogEntry;
|
||||||
use App\Models\School;
|
use App\Models\School;
|
||||||
use App\Models\SchoolEmailDomain;
|
use App\Models\SchoolEmailDomain;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
@ -37,8 +38,9 @@ class SchoolController extends Controller
|
||||||
|
|
||||||
public function show(School $school)
|
public function show(School $school)
|
||||||
{
|
{
|
||||||
|
$logEntries = AuditLogEntry::whereJsonContains('affected->schools', $school->id)->orderBy('created_at', 'desc')->get();
|
||||||
|
|
||||||
return view('admin.schools.show', ['school' => $school]);
|
return view('admin.schools.show', compact('school', 'logEntries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(School $school)
|
public function edit(School $school)
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,11 @@ class StudentController extends Controller
|
||||||
$event_entries = $student->entries()->with('audition.flags')->get()->groupBy('audition.event_id');
|
$event_entries = $student->entries()->with('audition.flags')->get()->groupBy('audition.event_id');
|
||||||
$events = Event::all();
|
$events = Event::all();
|
||||||
|
|
||||||
|
$logEntries = AuditLogEntry::whereJsonContains('affected->students', $student->id)->orderBy('created_at',
|
||||||
|
'desc')->get();
|
||||||
|
|
||||||
return view('admin.students.edit',
|
return view('admin.students.edit',
|
||||||
compact('student', 'schools', 'minGrade', 'maxGrade', 'events', 'event_entries'));
|
compact('student', 'schools', 'minGrade', 'maxGrade', 'events', 'event_entries', 'logEntries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(StudentStoreRequest $request, Student $student)
|
public function update(StudentStoreRequest $request, Student $student)
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,10 @@ class UserController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
$schools = School::orderBy('name')->get();
|
$schools = School::orderBy('name')->get();
|
||||||
|
$logEntries = AuditLogEntry::whereJsonContains('affected->users', $user->id)->orderBy('created_at', 'desc')->get();
|
||||||
|
$userActions = AuditLogEntry::where('user', $user->email)->orderBy('created_at', 'desc')->get();
|
||||||
|
|
||||||
return view('admin.users.edit', ['user' => $user, 'schools' => $schools]);
|
return view('admin.users.edit', compact('user', 'schools', 'logEntries', 'userActions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
|
|
|
||||||
|
|
@ -127,4 +127,29 @@
|
||||||
|
|
||||||
</x-card.list.body>
|
</x-card.list.body>
|
||||||
</x-card.card>
|
</x-card.card>
|
||||||
|
|
||||||
|
<x-card.card class="mt-5">
|
||||||
|
<x-card.heading>Log Entries</x-card.heading>
|
||||||
|
<x-table.table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<x-table.th>Timestamp</x-table.th>
|
||||||
|
<x-table.th>IP</x-table.th>
|
||||||
|
<x-table.th>User</x-table.th>
|
||||||
|
<x-table.th>Message</x-table.th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<x-table.body>
|
||||||
|
@foreach($logEntries as $logEntry)
|
||||||
|
<tr>
|
||||||
|
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->user }}</x-table.td>
|
||||||
|
<x-table.td>{!! $logEntry->message !!}</x-table.td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</x-table.body>
|
||||||
|
</x-table.table>
|
||||||
|
</x-card.card>
|
||||||
</x-layout.app>
|
</x-layout.app>
|
||||||
|
|
|
||||||
|
|
@ -62,4 +62,30 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<x-card.card class="mt-5">
|
||||||
|
<x-card.heading>Log Entries</x-card.heading>
|
||||||
|
<x-table.table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<x-table.th>Timestamp</x-table.th>
|
||||||
|
<x-table.th>IP</x-table.th>
|
||||||
|
<x-table.th>User</x-table.th>
|
||||||
|
<x-table.th>Message</x-table.th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<x-table.body>
|
||||||
|
@foreach($logEntries as $logEntry)
|
||||||
|
<tr>
|
||||||
|
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->user }}</x-table.td>
|
||||||
|
<x-table.td>{!! $logEntry->message !!}</x-table.td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</x-table.body>
|
||||||
|
</x-table.table>
|
||||||
|
</x-card.card>
|
||||||
|
|
||||||
</x-layout.app>
|
</x-layout.app>
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,29 @@
|
||||||
</x-table.table>
|
</x-table.table>
|
||||||
</x-card.card>
|
</x-card.card>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
<x-card.card class="mt-5">
|
||||||
|
<x-card.heading>Log Entries</x-card.heading>
|
||||||
|
<x-table.table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<x-table.th>Timestamp</x-table.th>
|
||||||
|
<x-table.th>IP</x-table.th>
|
||||||
|
<x-table.th>User</x-table.th>
|
||||||
|
<x-table.th>Message</x-table.th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<x-table.body>
|
||||||
|
@foreach($logEntries as $logEntry)
|
||||||
|
<tr>
|
||||||
|
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->user }}</x-table.td>
|
||||||
|
<x-table.td>{!! $logEntry->message !!}</x-table.td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</x-table.body>
|
||||||
|
</x-table.table>
|
||||||
|
</x-card.card>
|
||||||
</x-layout.app>
|
</x-layout.app>
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,54 @@
|
||||||
</x-form.footer>
|
</x-form.footer>
|
||||||
</x-form.form>
|
</x-form.form>
|
||||||
</x-card.card>
|
</x-card.card>
|
||||||
|
|
||||||
|
<x-card.card class="mt-5">
|
||||||
|
<x-card.heading>User Actions</x-card.heading>
|
||||||
|
<x-table.table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<x-table.th>Timestamp</x-table.th>
|
||||||
|
<x-table.th>IP</x-table.th>
|
||||||
|
<x-table.th>User</x-table.th>
|
||||||
|
<x-table.th>Message</x-table.th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<x-table.body>
|
||||||
|
@foreach($userActions as $logEntry)
|
||||||
|
<tr>
|
||||||
|
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->user }}</x-table.td>
|
||||||
|
<x-table.td>{!! $logEntry->message !!}</x-table.td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</x-table.body>
|
||||||
|
</x-table.table>
|
||||||
|
</x-card.card>
|
||||||
|
|
||||||
|
<x-card.card class="mt-5">
|
||||||
|
<x-card.heading>Log Entries Affecting User</x-card.heading>
|
||||||
|
<x-table.table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<x-table.th>Timestamp</x-table.th>
|
||||||
|
<x-table.th>IP</x-table.th>
|
||||||
|
<x-table.th>User</x-table.th>
|
||||||
|
<x-table.th>Message</x-table.th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<x-table.body>
|
||||||
|
@foreach($logEntries as $logEntry)
|
||||||
|
<tr>
|
||||||
|
<x-table.td>{{ $logEntry->created_at }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->ip_address }}</x-table.td>
|
||||||
|
<x-table.td>{{ $logEntry->user }}</x-table.td>
|
||||||
|
<x-table.td>{!! $logEntry->message !!}</x-table.td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</x-table.body>
|
||||||
|
</x-table.table>
|
||||||
|
</x-card.card>
|
||||||
</x-layout.app>
|
</x-layout.app>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue