<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controllers\HasMiddleware;
use Illuminate\Routing\Controllers\Middleware;
use Illuminate\View\View;
use Spatie\Activitylog\Models\Activity;

class ActivityLogController extends Controller implements HasMiddleware
{
    public static function middleware(): array
    {
        return [new Middleware('can:activity_log.view')];
    }

    public function index(): View
    {
        $activities = Activity::with('causer')->latest()->paginate(25);

        return view('activity-log.index', compact('activities'));
    }
}
