<?php

namespace App\Http\Controllers;

use App\Http\Requests\DataTableRequest;
use App\Models\Logging;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Illuminate\Support\Facades\Log;
class LoggingController extends Controller
{
    /**
     * @return \Illuminate\Http\Response
     */
    public function logging()
    {
        return Inertia::render('Superuser/Activity/Logging');
    }

    /**
     * @param \App\Http\Requests\DataTableRequest $request
     * @return \Illuminate\Http\Response
     */
    public function records(DataTableRequest $request)
    {
        $request->validated();

        $rec = Logging::today()->select(['*'])->paginate($request->per_page ?: 30);

        Log::info("message",["rec" => $rec]);

        return $rec;
    }
}
