blob: 3039d47daaed0a82d036e0020108e38b282a2e08 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Log;
use Illuminate\Http\JsonResponse;
class LogController extends Controller
{
// Log bekijken
public function getLogs(): JsonResponse
{
$this->authorize('viewAny', Log::class);
$log = Log::cursorPaginate(15);
return response()->json(['data' => $log]);
}
public function getLogsStudent($id): JsonResponse
{
$this->authorize('viewAny', Log::class);
$logs = Log::where('actor_id', $id)->whereRaw('LOWER(actor) = ?', ['student'])->cursorPaginate(15);
return response()->json(['data' => $logs]);
}
public function getLogsCompany($id): JsonResponse
{
$this->authorize('viewAny', Log::class);
$logs = Log::where('actor_id', $id)->whereRaw('LOWER(actor) = ?', ['company'])->cursorPaginate(15);
return response()->json(['data' => $logs]);
}
public function getLogsAdmin($id): JsonResponse
{
$this->authorize('viewAny', Log::class);
$logs = Log::where('actor_id', $id)->whereRaw('LOWER(actor) = ?', ['admin'])->cursorPaginate(15);
return response()->json(['data' => $logs]);
}
}
|