authorize('viewAny', Log::class); return LogResource::collection(Log::paginate(self::PAGINATED_COUNT)); } /** * @OA\Get( * path="/api/logs/{id}", * summary="Get a specific log (only admin)", * tags={"Logs"}, * security={{"bearerAuth": {}}}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the log", * @OA\Schema(type="integer", example=1) * ), * @OA\Response( * response=200, * description="Log retrieved successfully", * @OA\JsonContent(ref="#/components/schemas/LogResource") * ), * @OA\Response( * response=403, * description="Forbidden" * ), * @OA\Response( * response=404, * description="Log not found" * ) * ) */ public function show(Log $log) { $this->authorize('view', $log); return $log; } /** * @OA\Delete( * path="/api/logs/{id}", * summary="Delete a specific log (only admin)", * tags={"Logs"}, * security={{"bearerAuth": {}}}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the log", * @OA\Schema(type="integer", example=1) * ), * @OA\Response( * response=200, * description="Log deleted successfully", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="This log is successfully deleted") * ) * ), * @OA\Response( * response=403, * description="Forbidden" * ), * @OA\Response( * response=404, * description="Log not found" * ) * ) */ public function destroy(Log $log) { $this->authorize('delete', $log); $log->delete(); return response()->json([ 'message' => 'This log is successfully deleted' ]); } }